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

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

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

with f as (select de.dept_no
                , de.emp_no
                , s.salary
                , rank() over (partition by dept_no order by salary desc ) as r
           from salaries s
                    inner join dept_emp de using (emp_no))
select dept_no
     , emp_no
     , salary as maxSalary
from f
where r = 1;

全部评论

相关推荐

05-12 16:04
已编辑
江西财经大学 Java
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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