select Department, Name, Salary
SELECT *, ROW_NUMBER() OVER (PARTITION BY b.Department ORDER BY b.Salary DESC) AS rn
(SELECT d.Name as Department, e.Name as Employee, e.Salary as Salary FROM Department d, Employee e where e.DepartmentID = d.ID)b
WHERE a.rn < 2
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.