employees-earning.sql (297B)
1 --This goes joins the employees with their managers in the employee table 2 --and only shows the employees who have a higher salary than their managers 3 --Speed: 695ms Beats: 68.63% 4 SELECT E.name as Employee 5 FROM Employee as E 6 INNER JOIN Employee as M 7 ON E.managerId = M.id 8 WHERE E.salary > M.salary