SQL problem - Classes More Than 5 Students
Problem
Query
SELECT
class
FROM Courses
GROUP BY class
HAVING COUNT(student) >= 5
Editorial Solution
Approach: Group By
SELECT
class
FROM
(SELECT
class, COUNT(student) AS num
FROM
courses
GROUP BY class) AS temp_table
WHERE
num >= 5
;