The Employee table holds all employees. Every employee has an Id, and there is also a column for the Department Id.
The Department table holds all departments of the company.
Write a SQL query to find employees who earn the top three salaries in each of the department. For the above tables, your SQL query should return the following rows (order of rows does not matter).
Select T.Department, T.Employee, T.Salary from ( select D.Name as Department, E.Name as Employee, E.Salary, dense_rank() over ( partition by DepartmentId order by Salary desc ) as rnk from Employee E join Department D on E.DepartmentId = D.Id ) T where rnk &lt; 4