① EXISTS 사용
입력
SELECT department_id, department_name
FROM departments a
WHERE EXISTS ( SELECT *
FROM employees b
WHERE a.department_id = b.department_id
AND b.salary > 3000)
ORDER BY a.department_name;
결과
DEPARTMENT_ID DEPARTMENT_NAME
------------- ---------------------------------
60 IT
110 경리부
30 구매/생산부
90 기획부
...
11 개의 행이 선택됨.