../E41084-03.epub /> ../E41084-03.mobi />

EXISTS Condition

An EXISTS condition tests for existence of rows in a subquery.

Description of exists_condition.gif follows
Description of the illustration exists_condition.gif

Table 7-11 shows the EXISTS condition.

Table 7-11 EXISTS Condition

Type of Condition Operation Example

TRUE if a subquery returns at least one row.

SELECT department_id
  FROM departments d
  (SELECT * FROM employees e
    WHERE d.department_id 
    = e.department_id)
   ORDER BY department_id;