Published Jun 4, 2021Updated Jul 13, 2022
Contribute to Docs
ORDER BY command sorts the result set by a particular column either alphabetically or numerically.
SELECT column_name FROM table_name ORDER BY column_name ASC | DESC;
ORDER BY can be set in two ways:
ASCis a keyword used to sort the results in ascending order (default).
DESCis a keyword used to sort the results in descending order.
The query below will sort by
birth_date, in descending order:
SELECT *FROM contactsORDER BY birth_date DESC;
- Anonymous contributorAnonymous contributor3077 contributions
- Anonymous contributor
Looking to contribute?
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn SQL on Codecademy
Analyze Data with SQLLearn to analyze data with SQL and prepare for technical interviews.
Includes 8 Courses