CJCoding With Joseph
15free / daySign inCreate account

Best Five Grades of Fall 2024

From enrollments, find the five highest grades among enrollments dated from 2024-09-01 to 2024-12-31 inclusive. Return student_id, course_id, enrolled_on and grade, highest grade first. Dates are stored as ISO text, so a range test works on them directly.

Expected result:

+------------+-----------+-------------+-------+
| student_id | course_id | enrolled_on | grade |
+------------+-----------+-------------+-------+
|         15 |         5 | 2024-09-05  |    97 |
|         15 |         6 | 2024-09-05  |    95 |
|         25 |         1 | 2024-09-05  |    93 |
|         19 |         1 | 2024-09-10  |    91 |
|          9 |         5 | 2024-09-06  |    90 |
+------------+-----------+-------------+-------+
5 rows
Hints3 available
Topics:
SELECT Basics
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (sel, ins, desc)

Results

Run your SQL to see every statement's output here, then how it compares with the expected answer.

Not sure what is in a table? SHOW TABLES lists them and DESCRIBE students shows the columns — or open the database browser on the left.