Student Grades
Beginner
10 XP
You can try this as a guest. Sign in to hand it in and keep your progress.
Sign in
Write a SQL query to find the average grade by subject.
The data
A students table and a grades table with subject, student_id, and score columns.
Tables
CREATE TABLE students (id INTEGER PRIMARY KEY, name TEXT, grade_level INTEGER);
CREATE TABLE grades (id INTEGER PRIMARY KEY, student_id INTEGER, subject TEXT, score INTEGER);
To pass
Need a hint?
- Use AVG() to calculate the average.
- GROUP BY groups rows that have the same value.
- SELECT subject, AVG(score) FROM grades GROUP BY subject;