Simple Solution

  • 1

    select D.Name as Department, E.Name as Employee, E.Salary from Department D, Employee E, (select DepartmentId, max(Salary) as Salary from Employee group by DepartmentId) S where E.DepartmentId = S.DepartmentId and E.Salary = S.Salary and D.Id = E.DepartmentId

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.