https://leetcode.com/problems/department-top-three-salaries/description/
WITH CTE AS(
SELECT B.name AS Department,
A.name AS Employee,
salary,
DENSE_RANK() OVER(PARTITION BY departmentId ORDER BY salary DESC) AS dr
FROM Employee A
INNER JOIN Department B ON A.departmentId = B.id
)
SELECT Department,
Employee,
salary AS Salary
FROM CTE
WHERE dr<=3