Learn SQL
Arithmetic - Filtering and Ordering
27.9
Lesson

Order using arithmetic

Display the name, age and grade of students in the ascending order of difference of their age and grade for students who have both age data and grade data.

We can use an arithmetic expression in ORDER BY clause to achieve this.