Aggregating Joined Data
sql
1SELECT c.course_name, COUNT(*) AS students
2FROM students s
3JOIN courses c ON s.course_id = c.id
4GROUP BY c.course_name;
1SELECT c.course_name, COUNT(*) AS students
2FROM students s
3JOIN courses c ON s.course_id = c.id
4GROUP BY c.course_name;