Database Reference
In-Depth Information
6.1.1
Some Simple ORDER BY Clause Examples
Here's an example query with no ORDER BY clause:
SELECT A.NAME "Artist", S.DUE_DATE
, SYSDATE - S.DUE_DATE DAYS_LATE
, S.AMOUNT_CHARGED - S.AMOUNT_PAID BALANCE
FROM ARTIST A NATURAL JOIN STUDIOTIME S
WHERE S.AMOUNT_CHARGED > S.AMOUNT_PAID;
If you want to sort the results by DUE_DATE, you could simply add
this ORDER BY clause:
ORDER BY S.DUE_DATE;
Note:
The column in the ORDER BY clause is referenced by its table alias,
ā€œSā€.
The default order is ascending. Figure 6.2 shows the query and results in
ascending order by DUE_DATE.
Figure 6.2
Sorting by a Single
Column.
 
Search WWH ::




Custom Search