Skip
Arish's avatar

193. Practice - JOIN GROUP 3


Exercise: Sum by Instructor

Total marks taught by each instructor.

Solution

sql
1SELECT i.name, SUM(s.marks) AS total
2FROM instructors i
3JOIN courses c ON i.id = c.instructor_id
4JOIN students s ON s.course_id = c.id
5GROUP BY i.name;