Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Mysql branch #8

Merged
the1Riddle merged 2 commits into rezzcode:main from the1Riddle:mysql-branch
May 23, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Update managers-with-at-least-5-direct-reports.sql
  • Loading branch information
the1Riddle authored May 19, 2024
commit e2e3bccd9edc74965b51c73edc3294dc74cea1ba
18 changes: 5 additions & 13 deletions MySQL/managers-with-at-least-5-direct-reports.sql
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
# Time: O(n)
# Space: O(n)

SELECT
Name
FROM
Employee AS t1 INNER JOIN
(SELECT
ManagerId
FROM
Employee
GROUP BY ManagerId
HAVING COUNT(ManagerId) >= 5
ORDER BY NULL) AS t2
ON t1.Id = t2.ManagerId
;
SELECT name FROM Employee WHERE id IN (
SELECT managerId
FROM Employee
GROUP BY managerId
HAVING COUNT(*) >= 5)

AltStyle によって変換されたページ (->オリジナル) /