Problem: 1978. 上级经理已离职的公司员工
Code
-- 方法 1
-- select e1.employee_id
-- from employees e1
-- left join employees e2
-- on e1.manager_id = e2.employee_id
-- where e1.salary < 30000
-- and e1.manager_id is not null
-- and e2.employee_id is null
-- order by e1.employee_idselect employee_id
from employees
where salary < 30000
and manager_id not in (select employee_id from employees)
order by employee_id