Skip
Arish's avatar

194. Practice - JOIN GROUP 4


Exercise: Count with HAVING

Courses with more than 5 students.

Solution

sql
1SELECT c.course_name, COUNT(*) AS count
2FROM students s
3JOIN courses c ON s.course_id = c.id
4GROUP BY c.course_name
5HAVING COUNT(*) > 5;