题解 | #获取每个部门中当前员工薪水最高的相关信息#
获取每个部门中当前员工薪水最高的相关信息
https://www.nowcoder.com/practice/4a052e3e1df5435880d4353eb18a91c6
with a as ( select dept_emp.emp_no,dept_no,salary,rank() over(partition by dept_no order by salary desc) as rk from dept_emp left join salaries on dept_emp.emp_no = salaries.emp_no ) select dept_no,emp_no,salary as maxSalary from a where rk = 1 order by dept_no
窗口函数秒