题解 | #获取所有非manager员工当前的薪水情况#

获取所有非manager员工当前的薪水情况

http://www.nowcoder.com/practice/8fe212a6c71b42de9c15c56ce354bebe

这题还挺简单的. 

关键点就是where子句排除经理.
select 
 -- 员工部门 
 t1.dept_no ,
 t1.emp_no , 
 (select t3.salary from salaries t3 where t3.emp_no = t1.emp_no) as salary
from dept_emp t1 
where not EXISTS 
(
  select 1 from dept_manager t2 
  where t1.emp_no = t2.emp_no 
)

全部评论

相关推荐

代码飞升:别用口语,后端就写后端,前端就写前端,最后别光后悔
点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
07-09 12:05
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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