Skip to content

Commit 935ea4c

Browse files
authored
Create find-the-team-size.sql
1 parent 5fff7be commit 935ea4c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

MySQL/find-the-team-size.sql

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Time: O(n)
2+
# Space: O(n)
3+
4+
SELECT employee_id,
5+
team_size
6+
FROM employee AS e
7+
LEFT JOIN (SELECT team_id,
8+
Count(1) AS team_size
9+
FROM employee
10+
GROUP BY team_id) AS teams
11+
ON e.team_id = teams.team_id

0 commit comments

Comments
 (0)