SQL 문제풀이
leetcode - 596. Classes More Than 5 Students
Jerrytwo
2022. 7. 5. 17:20
난이도 : Easy
Table: Courses
+-------------+---------+
| Column Name | Type |
+-------------+---------+
| student | varchar |
| class | varchar |
+-------------+---------+
(student, class) is the primary key column for this table.
Each row of this table indicates the name of a student and the class in which they are enrolled.
Write an SQL query to report all the classes that have at least five students.
Return the result table in any order.
SELECT class
FROM Courses
GROUP BY class
HAVING COUNT(student)>= 5
Accepted (33.45%)