An EXISTS condition tests for existence of rows in a subquery.
EXISTS
Table 7-11 shows the EXISTS condition.
Table 7-11 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) ORDER BY department_id;
Scripting on this page enhances content navigation, but does not change the content in any way.