获取员工其当前的薪水比其manager

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

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

SELECT de.dept_no,de.emp_no,s.salary FROM dept_emp de JOIN salaries s ON de.emp_no=s.emp_no #employee salary

SELECT dm.dept_no,dm.emp_no,s2.salary FROM dept_manager dm JOIN salaries s2 ON s2.emp_no=dm.emp_no #manager salary

SELECT a.emp_no,b.emp_no as manager_no,a.salary AS emp_salary,b.salary AS manager_salary FROM(SELECT de.dept_no,de.emp_no,s.salary FROM dept_emp de JOIN salaries s ON de.emp_no=s.emp_no) as a JOIN(SELECT dm.dept_no,dm.emp_no,s2.salary FROM dept_manager dm JOIN salaries s2 ON s2.emp_no=dm.emp_no) AS b ON a.dept_no=b.dept_no WHERE a.salary>b.salary;

# 连接条件 dept_no 相同 WHERE 员工工资>manager工资

全部评论

相关推荐

10-04 17:25
门头沟学院 Java
snqing:Java已经饱和了,根本不缺人。随便一个2000工资的都200人起投递
点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务