题解 | #获取当前薪水第二多的员工的emp_no以及其对应的薪水salary#

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

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

select dept_emp.emp_no,dept_manager.emp_no manager_no,s1.salary emp_salary,s2.salary manager_salary
from dept_emp,dept_manager,salaries s1,salaries s2
where dept_manager.dept_no = dept_emp.dept_no 
and dept_emp.emp_no = s1.emp_no
and dept_manager.emp_no = s2.emp_no
and s1.salary>s2.salary

这里主要使用了分表,将salaries分为s1,s2分别查出员工和经理的工资

全部评论

相关推荐

牛客96763241...:杭电✌️也是打完招呼,没人回吗
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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