Show TOC

Exists predicateLocate this document in the navigation structure

The exists predicate is used to test if a subquery returns any rows.

Syntax

<exists predicate> ::= 
             EXISTS '(' <query specification> ')'.

            

The result of the < exists predicate > is true if the result of the < query specification > is not empty (contains one or more rows), otherwise the result of the <exists predicate> is false .

Example

SELECT * FROM a WHERE EXISTS 
                ( SELECT * FROM b WHERE b.c = 0 )

            

The EXISTS Predicate. This query contains an uncorrelated subquery. It returns all rows from table a if there is at least one row in table b for which the column c of table b has the value 0.

More Information

Query Specification