File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed
Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ Have a good contributing!
4141 - [ 577. Employee Bonus] ( ./leetcode/easy/577.%20Employee%20Bonus.sql )
4242 - [ 586. Customer Placing the Largest Number of Orders] ( ./leetcode/easy/586.%20Customer%20Placing%20the%20Largest%20Number%20of%20Orders.sql )
4343 - [ 595. Big Countries] ( ./leetcode/easy/595.%20Big%20Countries.sql )
44+ - [ 596. Classes With at Least 5 Students] ( ./leetcode/easy/596.%20Classes%20With%20at%20Least%205%20Students.sql )
44452 . [ Medium] ( ./leetcode/medium/ )
4546 - [ 176. Second Highest Salary] ( ./leetcode/medium/176.%20Second%20Highest%20Salary.sql )
4647
Original file line number Diff line number Diff line change 1+ /*
2+ Question 596. Classes With at Least 5 Students
3+ Link: https://leetcode.com/problems/classes-with-at-least-5-students/description/
4+
5+ Table: Courses
6+
7+ +-------------+---------+
8+ | Column Name | Type |
9+ +-------------+---------+
10+ | student | varchar |
11+ | class | varchar |
12+ +-------------+---------+
13+ (student, class) is the primary key (combination of columns with unique values) for this table.
14+ Each row of this table indicates the name of a student and the class in which they are enrolled.
15+
16+
17+ Write a solution to find all the classes that have at least five students.
18+
19+ Return the result table in any order.
20+ */
21+
22+ SELECT class
23+ FROM Courses
24+ GROUP BY class
25+ HAVING COUNT (1 ) >= 5
You can’t perform that action at this time.
0 commit comments