Icon EXISTS

Returns whether or not any rows exist in a given subquery.

Syntax
EXISTS(<QueryExpression>)

<QueryExpression> = SELECT statement

Returns
BOOLEAN

Usage
The EXISTS function returns the TRUE if a given sub-query returns any rows, or FALSE if the sub-query does not return any rows. EXISTS is useful in situations where you simply want to know if any rows are present for a given set of conditions, which would be expressed via the WHERE clause of the sub-query.

Examples
SELECT *
FROM Customers
WHERE EXISTS(SELECT * FROM Orders
             WHERE Orders.CustomerNo=Customers.CustomerNo)

SQL 2003 Standard Deviations
This function deviates from the SQL 2003 standard in the following ways:

DeviationDetails
None
Image