Skip to content

Commit 0341ea1

Browse files
authored
Update managers-with-at-least-5-direct-reports.sql (#6)
1 parent 56f9879 commit 0341ea1

File tree

1 file changed

+5
-13
lines changed

1 file changed

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

4-
SELECT
5-
Name
6-
FROM
7-
Employee AS t1 INNER JOIN
8-
(SELECT
9-
ManagerId
10-
FROM
11-
Employee
12-
GROUP BY ManagerId
13-
HAVING COUNT(ManagerId) >= 5
14-
ORDER BY NULL) AS t2
15-
ON t1.Id = t2.ManagerId
16-
;
4+
SELECT name FROM Employee WHERE id IN (
5+
SELECT managerId
6+
FROM Employee
7+
GROUP BY managerId
8+
HAVING COUNT(*) >= 5)
179

0 commit comments

Comments
 (0)