MSSQL Window function
\nSELECT\n    d.Name AS Department,\n    Sel.Name AS Employee,\n    Sel.Salary AS Salary\nFROM\n(\n    SELECT\n        Name,\n        Salary,\n        Departmen
```\nSELECT\n    d.Name AS Department,\n    Sel.Name AS Employee,\n    Sel.Salary AS Salary\nFROM\n(\n    SELECT\n        Name,\n        Salary,\n        DepartmentId,\n        DENSE_RANK() OVER (PARTITION BY DepartmentId ORDER BY Salary DESC) AS dr\n    FROM Employee \n) AS Sel\nINNER JOIN Department d ON d.Id = Sel.DepartmentId\nWHERE Sel.dr = 1\n```
[]