Skip to main content
Returns a single UInt8-type column, which contains the single value 0 if the table or database does not exist, or 1 if the table exists in the specified database.

Subquery form

The EXISTS operator checks whether a subquery returns any rows. It returns 0 if the subquery result is empty; otherwise, it returns 1. You can use EXISTS in a WHERE clause. The subquery cannot reference tables or columns from the outer query. Syntax
Examples Check whether a subquery returns rows:
Query
Response
Use EXISTS in a WHERE clause with a subquery that returns several rows:
Query
Response
When the subquery result is empty, EXISTS returns 0:
Query
Response
Last modified on October 1, 2026