Skip
Arish's avatar

86. Multiple Column Sorting


Sort by Multiple Columns

sql
1SELECT * FROM students
2ORDER BY grade, marks;

Example

Sort by grade first, then marks within grade:

sql
1SELECT name, grade, marks FROM students
2ORDER BY grade, marks;

Result

namegrademarks
DavidA85
AliceA92
BobB75
CarolB78