Skip
Arish's avatar

158. Practice - GROUP with ORDER


Exercise: Sort Groups

Sort grades by average marks descending.

Solution

sql
1SELECT grade, AVG(marks) AS avg_marks
2FROM students
3GROUP BY grade
4ORDER BY avg_marks DESC;