The ORDER BY keyword is used to sort the result-set in ascending or descending order.

ascending order by default

use DESC keyword to sort in descending order

Sort by one particular column

Order by ASC

SELECT * FROM Customers
ORDER BY Country;

Order by Desc

SELECT * FROM Customers
ORDER BY Country DESC;

Sort by multiple columns

use several columns, for example, columnA and columnB means sort first by columnA, but if some rows have the same columnA, it orders them by columnB

SELECT * FROM Customers
ORDER BY Country, CustomerName;

Sort by multiples with a mixture of ascending and descending

The following SQL statement selects all customers from the "Customers" table, sorted ascending by the "Country" and descending by the "CustomerName" column:

SELECT * FROM Customers
ORDER BY Country ASC, CustomerName DESC;