Skip to content

Commit 229031c

Browse files
authored
employees-earning-more-than-their-managers
1 parent 91a9972 commit 229031c

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# Time: O(n^2)
22
# Space: O(1)
33

4-
SELECT e.Name AS Employee FROM Employee e LEFT JOIN Employee b
5-
ON e.ManagerId=b.Id
6-
WHERE e.Salary > b.Salary
7-
8-
SELECT Name AS Employee
9-
FROM Employee e
10-
WHERE e.ManagerId IS NOT NULL AND e.Salary > (SELECT Salary
11-
FROM Employee
12-
WHERE e.ManagerId = Id)
4+
SELECT e.Name AS Employee FROM Employee e LEFT JOIN Employee b
5+
ON e.ManagerId=b.Id WHERE e.Salary > b.Salary
6+
7+
/** # Write your MySQL query statement below **/
8+
/** solution two **/
9+
10+
SELECT e.name AS employee
11+
FROM employee AS e JOIN employee AS e1 ON e.managerid = e1.id
12+
WHERE e.salary > e1.salary;
1313

0 commit comments

Comments
 (0)