+

Search Tips   |   Advanced Search

EXISTS predicate

The exists predicate tests for the presence or absence of a condition specified by a subselect.

Use the following syntax:

The result of EXISTS is true if the subselect returns at least one value or the path expression evaluates to a nonempty collection, otherwise the result is false.

To negate an EXISTS predicate, precede it with the logical operator NOT.


Example: EXISTS predicate

Return departments that have at least one employee earning more than 1000000:

Return departments that have no employees:

The previous query can also be written as follows:


Related concepts

  • EJB query language
  • WHERE clause


    Related tasks

  • Use EJB query