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