10.获取所有非manager的员工emp_no

获取所有非manager的员工emp_no

http://www.nowcoder.com/questionTerminal/32c53d06443346f4a2f2ca733c19660c

法一:内连接

select e.emp_no
from employees e
where e.emp_no not in (select emp_no
                       from dept_manager d)

法二:左连接+NULL

select e.emp_no
from employees e left join dept_manager d on d.emp_no = e.emp_no
where d.dept_no is null

本身题目不难,manager就是有dept_no的人,d.dept_no is null就是非manager的员工

数据分析阿宇君的SQL题解 文章被收录于专栏

数据分析的SQL题目

全部评论

相关推荐

点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务