select
department,
employee_name,
salary
from
(
select
department,
employee_name,
salary,
rank() over (
partition by
department
order by
salary desc
) as num
from
employees
) as a
where
a.num <= 2

京公网安备 11010502036488号