Skip
Arish's avatar

135. Practice - Sort by Calculation


Exercise: Sort by Combined

Sort by marks minus age.

Solution

sql
1SELECT name, marks, age, marks - age AS diff
2FROM students
3ORDER BY marks - age DESC;