SQL ORDER BY

ORDER BY is used to sort query results according to the value of the specified column.

By default, is sorted in ascending (ASC) based on column values.

If you want to sort in descending order using the word DES

SELECT columnName (s) FROM tablename ORDER BY columnName (s) ASC | DESC

For example, in people table:

namesurnamenickname
HARRYCLARKWHITE
WILLIAMJONESCLARK
HARRYSMITHBENITO

SELECT name, surname FROM people ORDER BY surname ASC

This is the resulting query:

namesurname
HARRYCLARK
WILLIAMJONES
HARRYSMITH

Example DES

SELECT name, surname FROM people ORDER BY surname DESC

This is the resulting query:

namesurname
HARRYSMITH
WILLIAMJONES
HARRYCLARK