Find the three highest quiz scores
Sort results and limit them to the records you need.
Read the taskTry your answerLearn from feedback
YOUR TASK
Return name and score, in that order, for the three highest scoring students. Use ORDER BY score DESC and LIMIT 3. There are no tied scores in the test datasets.
Give me a hint
DESC puts larger scores first. LIMIT controls how many rows are returned.
Show the worked solution
SELECT name, score FROM students ORDER BY score DESC LIMIT 3;Sort before taking the first three rows. LIMIT without ORDER BY would return the first three source rows, not the highest scores.
TABLE: STUDENTS
| name | score |
|---|---|
| Ananya | 82 |
| Arjun | 64 |
| Meera | 91 |
| Kabir | 75 |
| Diya | 88 |
| Rohan | 59 |
Practice subset: SELECT name, score FROM students; numeric score filters; ORDER BY score ASC/DESC; LIMIT. No database connection or changes.
