Skip to content

Commit 2087cbe

Browse files
committed
task: #596
1 parent a832f81 commit 2087cbe

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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)
4445
2. [Medium](./leetcode/medium/)
4546
- [176. Second Highest Salary](./leetcode/medium/176.%20Second%20Highest%20Salary.sql)
4647

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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

0 commit comments

Comments
 (0)