Learn SQL
ORDER BY - Ascending and Descending
21.1
Lesson

Order students by marks in descending order

Find name and marks of all students with their respective marks in descending order.

We can add DESC to the name of the column in ORDER BY clause to achieve this.

DESC is the SQL syntax equivalent of DESCENDING. Similary, to sort the same data in ascending order, we can add ASC to the name of the column in ORDER BY.

Mentioning ASC is optional, as the default order of sorting in SQL is ascending, unless specified explicitly.