Expansion of Exists-predicate

The exists-predicate tests for the existence of data meeting criteria specified in a subquery.
idmscu19
The exists-predicate tests for the existence of data meeting criteria specified in a subquery.
Syntax
Expansion of exists-predicate
►►─── EXISTS ( 
subquery
 ) ────────────────────────────────────────────────────►◄
Parameters
  • ( subquery )
    Specifies a subquery that returns a set of zero or more rows. For expanded
    subquery
    syntax, see Expansion of Subquery.
Usage
Truth Value of an EXISTS Predicate
The result of an EXISTS predicate is:
  • True when the result of the subquery is a set containing one or more rows
  • False when the result of the subquery is an empty set
Example
With the Unary Operator NOT in a WHERE Parameter
The following SELECT statement identifies employees for whom no expertise information has been stored in the database.
select e1.emp_id    from employee e1    where not exists       (select * from expertise e2       where e1.emp_id = e2.emp_id);
For more information about search conditions, see Expansion of Search-condition.