题解 | 获取每个部门中薪水最高的员工相关信息
select dept_no ,emp_no ,salary from(select dept_no ,emp_no ,salary ,rank()over(partition by dept_no order by salary desc) rk from dept_emp d join salaries using(emp_no)) t where rk = 1 order by dept_no
select dept_no ,emp_no ,salary from(select dept_no ,emp_no ,salary ,rank()over(partition by dept_no order by salary desc) rk from dept_emp d join salaries using(emp_no)) t where rk = 1 order by dept_no
相关推荐