Study - Problems(IT)/LeetCode - SQL
596. Classes More Than 5 Students
Dev.D
2024. 11. 23. 22:34
* Problem
Write a solution to find all the classes that have at least five students.
Return the result table in any order.
* Explanation
- Math has 6 students, so we include it.
- English has 1 student, so we do not include it.
- Biology has 1 student, so we do not include it.
- Computer has 1 student, so we do not include it.
* Solution (Success)
SELECT class
FROM Courses
GROUP BY 1
HAVING COUNT(*) >= 5;