Professional Documents
Culture Documents
DBHW1
DBHW1
DBHW1
developer.
1) Sorting rows by multiple columns example
To sort multiple columns, you separate each column in the ORDER BY clause by a comma.
For example, to sort contacts by their first names in ascending order and their last names in
descending order, you use the following statement:
SELECT
first_name,
last_name
FROM
contacts
ORDER BY
first_name,
last_name DESC;
3) The following statement retrieves locations and sorts them by city and state:
SELECT
country_id,
city,
state
FROM
locations
ORDER BY
city,
state;