Generate students grade report

Warm-up · joins, sorting

Given 3 tables, students(id, name), courses(id, name), grades(id, course_id, student_id, grade),

list every course each student is enrolled in along with the grade they scored in it.

Order by student name ascending, break ties by course name ascending, then by grade ascending.

Output the columns (name, course, grade).

Expected columns

name, course, grade

Hints

Hint 1 — which joins

grades links the other two tables: join students on grades.student_id and courses on grades.course_id. Each grades row is one line of the report. SHOW INDEX FROM grades shows which of those join columns are indexed.

Hint 2 — nothing to group

There is no aggregate in the output, so GROUP BY only adds a temporary table. ORDER BY name, course, grade is all you need.