Skip
Arish's avatar

100. Top N Results


Getting Top Results

Combine ORDER BY and LIMIT.

sql
1SELECT * FROM students
2ORDER BY marks DESC
3LIMIT 10;

Returns top 10 highest marks.

Top Performers

sql
1SELECT name, marks FROM students
2ORDER BY marks DESC
3LIMIT 5;