August 2002
Intermediate to advanced
528 pages
10h 12m
English
The ORDER BY clause is used to change the order records that the SELECT statement displays. This clause tells Oracle which columns determine the record order. Column or expression names placed after the ORDER BY keywords determine the order. A comma is used to separate the names.
This clause is always the last clause in the SELECT statement because the ordering is performed on the selected records after they are placed in memory. The other clauses tell Oracle what to retrieve from the database. After the values are retrieved, the ordering occurs.
Listing 4.20 illustrates a SELECT statement that contains an ORDER BY clause. The clause orders the employees in the POL department by last name.