직원의 월급이 30000달러 이하이고 매니저가 회사를 떠난
직원의 아이디를 출력하라.
WHERE 절 서브쿼리
SELECT employee_id
FROM Employees
WHERE manager_id NOT IN (SELECT employee_id
FROM Employees)
AND salary <30000
ORDER BY employee_id
SELF JOIN
SELECT e1.employee_id
FROM Employees e1
LEFT JOIN Employees e2
ON e1.manager_id =e2.employee_id
WHERE e1.manager_id IS NOT NULL
AND e2.employee_id IS NULL
AND e1.salary <30000
ORDER BY e1.employee_id