题解 | #获取每个部门中当前员工薪水最高的相关信息#

获取每个部门中当前员工薪水最高的相关信息

https://www.nowcoder.com/practice/4a052e3e1df5435880d4353eb18a91c6

with t0 as (
    #找出部门的最高工资
select 
d.emp_no,
dept_no,
salary,
max(salary) over(partition by dept_no) as max_salary
from salaries s 
left join  dept_emp d on  d.emp_no = s.emp_no

)
select dept_no,emp_no, salary as maxSalary
from t0 where salary = max_salary
order by dept_no

全部评论

相关推荐

浩浩没烦恼:一二面加起来才一个小时? 我一面就一个小时多了
点赞 评论 收藏
分享
爱吃烤肠的牛油最喜欢...:50K是ssp了估计,ssp的人家多厉害都不用说,每年比例大概在百分之5左右
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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