You can also ORDER BY two or more columns, which creates
a nested sort. The default is still ascending, and the
column that is listed first in the ORDER BY clause takes precedence.
The
following query and Query and
the corresponding query results show nested sorts. To modify the order
in which selected data is displayed, change the order of the two columns
that are named in the ORDER BY clause.
In the query result, the manu_code column data
appears in alphabetical order and, within each set of rows with the
same manu_code (for example, ANZ, HRO), the unit_price is
listed in ascending order.
The following query shows the reverse order of the columns
in the ORDER BY clause.
In the query result, the data appears in ascending order
of unit_price and, where two or more rows have the same unit_price (for
example, $20.00, $48.00, $312.00), the manu_code is in alphabetical
order.
The order of the columns in the ORDER BY clause is important,
and so is the position of the DESC keyword. Although the statements
in the following query contain the same components in the ORDER BY
clause, each produces a different result (not shown).