MSSQL solution with DENSE_RANK()
\n# Code\n\n/* Write your T-SQL query statement below */\nSELECT\n    Department, Employee, Salary\nFROM\n(SELECT\n    D.NAME AS Department,\n    E.NAME AS Empl
\n# Code\n```\n/* Write your T-SQL query statement below */\nSELECT\n    Department, Employee, Salary\nFROM\n(SELECT\n    D.NAME AS Department,\n    E.NAME AS Employee,\n    E.SALARY AS Salary,\n    DENSE_RANK() OVER(PARTITION BY D.NAME ORDER BY E.SALARY DESC) AS rank\nFROM \n    EMPLOYEE E\nJOIN \n    DEPARTMENT D ON D.ID = E.DEPARTMENTID) AS R\nWHERE R.rank = 1;\n```
['MS SQL Server']