← Back to SELECT Basics
Question 37
Best Five Grades of Fall 2024
Best Five Grades of Fall 2024
Fromenrollments, find the five highest grades among enrollments dated from2024-09-01to2024-12-31inclusive. Returnstudent_id,course_id,enrolled_onandgrade, 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
Sign in to use hintsTopics:
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.