SQLite ORDER BY Keyword
The ORDER BY Keyword
ORDER BY sorts the result. By default, it sorts in ascending order, from lowest to highest.
This example sorts the products by price:
DESC
Add DESC to sort in descending order, from highest to lowest:
Sort Text
Text is sorted alphabetically:
With DESC, text is sorted in reverse alphabetical order:
Sort by More Than One Column
This example sorts the customers by country. Customers in the same country are sorted by name:
Each column can have its own direction. This example sorts the countries ascending, and the names descending: