248ms Ans beats 99% and illustration
The most tricky part is to get the actual name of each department. Otherwise it is a simple question\nFirst we find the max price from the employee table of eac
The most tricky part is to get the actual name of each department. Otherwise it is a simple question\nFirst we find the max price from the employee table of each departmentID\nSecond, join the filtered employee table and department table and get the name of department\n```\nselect Department.Name as Department, a.Name as Employee,  a.Salary as Salary\nfrom Department\njoin (select Name, Salary, DepartmentId from Employee \n      where (DepartmentId, Salary) in (\n          select DepartmentId, max(Salary)   # find the max price  of each departmentID\n          from Employee\n          group by DepartmentId)) as a \n     on Department.Id = a.DepartmentId\n```
[]