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