题解 | #获取所有非manager的员工emp_no#
获取所有非manager的员工emp_no
https://www.nowcoder.com/practice/32c53d06443346f4a2f2ca733c19660c
解1:not exists + 子查询
select
emp_no
from employees e
where not exists (
select
1
from dept_manager
where emp_no = e.emp_no
)
解2:not in + 子查询
select
emp_no
from employees e
where emp_no not in (
select
emp_no
from dept_manager
)
解3:left join
select
e.emp_no
from employees e
left join dept_manager dm on dm.emp_no = e.emp_no
where dm.emp_no is null
#关于秋招我想说#SQL杂谈 文章被收录于专栏
让SQL飞一会