Show TOC

Syntax documentationExists predicate Locate this document in the navigation structure

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

Syntax

Syntax Syntax

  1. <exists predicate> ::= 
                 EXISTS '(' <query specification> ')'.
    
End of the code.

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

Syntax Syntax

  1. SELECT * FROM a WHERE EXISTS 
                    ( SELECT * FROM b WHERE b.c = 0 )
    
End of the code.

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