获取员工其当前的薪水比其manager当前薪水还高的相关信息

获取员工其当前的薪水比其manager当前薪水还高的相关信息

https://www.nowcoder.com/practice/f858d74a030e48da8e0f69e21be63bef

select t2.emp_no emp_no,t1.emp_no manager_no,t2.salary emp_salary,t1.salary manager_salary
from 
#部门经理的薪水
(select dm.dept_no dept_no,dm.emp_no emp_no,s.salary salary
from dept_manager dm join salaries s on dm.emp_no=s.emp_no)t1
,
#非部门经理的薪水
(select de.dept_no dept_no,de.emp_no emp_no,s.salary salary
from dept_emp de join salaries s on de.emp_no=s.emp_no
where de.emp_no not in 
(select  dm.emp_no from dept_manager dm))t2

where t1.dept_no=t2.dept_no and t1.salary<t2.salary

全部评论

相关推荐

程序员花海:实习和校招简历正确格式应该是教育背景+实习+项目经历+个人评价 其中项目经历注意要体现业务 实习经历里面的业务更是要自圆其说 简历模板尽可能保持干净整洁 不要太花哨的
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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