Skip Headers
An EXISTS condition tests for existence of rows in a subquery.
EXISTS
exists_condition::=
Table 5-10 shows the EXISTS condition.
TRUE if a subquery returns at least one row.
TRUE
SELECT department_id FROM departments d WHERE EXISTS (SELECT * FROM employees e WHERE d.department_id = e.department_id);