All problems

The Honor Roll

easySQLFilteringSorting

Twice a year Fairhaven University posts an honor roll and sends a letter home to each student on it. The rule the faculty senate voted through is simple: a grade point average of 3.6 or better puts you on the list, and 3.6 exactly counts — the boundary is generous on purpose.

The letters are printed in the sequence the query returns them, and the dean reads the top of the list out at the ceremony, so the strongest student has to arrive first rather than whoever happens to sit first in the table.

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 two columns, name and gpa, for every student on the honor roll — grade point average of 3.6 or better, the boundary included — with the highest GPA first.

Example output

Shape only — these students and averages are invented. A whole figure comes back plain, as 4 rather than 4.0:

name gpa
Mira Sun 4
Dana Ruiz 3.75
Hugo Lam 3.65

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…