Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Ordering

Select all columns from the customers table, ordered by city (ascending):

SELECT *
FROM customers
ORDER BY city;

Select all columns from the customers table, ordered by city (descending):

SELECT *
FROM customers
ORDER BY city DESC;

Select all columns from the customers table, ordered by country then city:

SELECT *
FROM customers
ORDER BY country, city;