题解 | #获取所有非manager的员工emp_no#
获取所有非manager的员工emp_no
http://www.nowcoder.com/practice/32c53d06443346f4a2f2ca733c19660c
首先想到的就是这个员工的编号emp_no不在manager 所以冒出not in
-- not in
select a.emp_no from employees a left join dept_manager b
on a.emp_no = b.emp_no
where a.emp_no not in (select distinct emp_no from dept_manager);
方法二:更简单的
select emp_no from employees
where emp_no not in (select distinct emp_no from dept_manager)