Descending order

Descending order is the opposite of ascending order, from lowercase z to uppercase A for character types, and from highest to lowest for numeric data types. DATE and DATETIME data is sorted from latest to earliest, and INTERVAL data is ordered from longest to shortest span of time. The following query shows an example of descending order.
Figure 1. Query
SELECT * FROM manufact ORDER BY lead_time DESC; 
The keyword DESC following a column name causes the retrieved data to be sorted in descending order, as the result shows.
Figure 2. Query result
manu_code manu_name       lead_time

 SHM       Shimara           30
 KAR       Karsten           21
 PRC       ProCycle           9
 NKL       Nikolus            8
 NRG       Norge              7
 HSK       Husky              5
 ANZ       Anza               5
 HRO       Hero               4
 SMT       Smith              3

You can specify any column of a built-in data type (except TEXT, BYTE, BLOB, or CLOB) in the ORDER BY clause, and the database server sorts the data based on the values in that column.


Copyright© 2020 HCL Technologies Limited