with ranking as( 
    select 
        department,
        employee_name,
        salary,
        rank() over(partition by department order by salary desc) as rank_num
        from employees)

select
department,
employee_name,
salary
from ranking
where rank_num<=2
order by department,salary desc