Exercise: Students in Popular Courses
Find students in courses with > 5 enrollments.
Solution
sql
1SELECT * FROM students
2WHERE course_id IN (
3 SELECT course_id FROM students
4 GROUP BY course_id HAVING COUNT(*) > 5
5);
Find students in courses with > 5 enrollments.
1SELECT * FROM students
2WHERE course_id IN (
3 SELECT course_id FROM students
4 GROUP BY course_id HAVING COUNT(*) > 5
5);