Intuitive Solution
Approach/Steps:\n1. Calculate department wise highest salaries\n\t\n\tselect DepartmentId, max(Salary) from Employee group by DepartmentId\n\t\n2. Fetch all Emp
Approach/Steps:\n1. Calculate department wise highest salaries\n\t```\n\tselect DepartmentId, max(Salary) from Employee group by DepartmentId\n\t```\n2. Fetch all Employees which are getting highest salary in the department\n\t```\n\tselect * from Employee\n\twhere (DepartmentId, Salary) in \n\t(select DepartmentId, max(Salary) from Employee group by DepartmentId)\n\t```\n3. Join the Employee and Department tables to get the department name in the result (Final Solution)\n\t```\n\tselect d.Name as Department, e.Name as Employee, Salary from Employee e join Department d on\n\te.DepartmentId = d.Id\n\twhere (e.DepartmentId, e.Salary) in \n\t(select DepartmentId, max(Salary) from Employee group by DepartmentId)\n\t```\n\nRuntime: 506 ms, faster than 87.68% submissions
['MySQL']