Employees Earning More Than Their Managers - LeetCode
| id | name | salary | managerId |
Write an SQL query to find the employees who earn more than their managers.
- code
SELECT
a.Name AS 'Employee'
FROM
Employee AS a,
Employee AS b
WHERE
a.ManagerId = b.Id
AND a.Salary > b.Salary
;
- code
select e1.name as "Employee" from Employee e1 inner join Employee e2 on e1.managerId = e2.id
where e1.salary > e2.salary