All problems

The Cohort Average

easySQLAggregation

Every accreditation cycle Fairhaven University files a return with the regional board, and one line on the form is the mean grade point average of the student body. The board rejects a submission that carries more precision than the form asks for, so the figure has to arrive already rounded to two decimal places rather than rounded by hand afterwards.

The student table is the whole population here — no sampling, no weighting by year group. Every enrolled student counts once.

students — one row per enrolled student. gpa is the grade point average already on file for that student, on a 0-4 scale.

id name major gpa
1 Nora Fischer Computer Science 3.8
2 Omar Haddad Statistics 3.4
3 Petra Novakova Computer Science 3.9
4 Quinn Walsh Mathematics 3.1
5 Ravi Shah Statistics 3.6

The table already exists in the database — there is nothing to create or load.

Task: Write a query that returns one row with one column, avg_gpa, holding the mean grade point average across all students, rounded to two decimal places.

Example output

If the cohort averaged three point one two, the single row would read:

avg_gpa
3.12

Sign in to solve this problem

Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.

Sign in

Discussion

Sign in to join the discussion — reading is open to everyone.

Loading comments…