ORDER BY
Description
The ORDER BY clause specifies the sorting of rows retrieved by the SELECT statement. FairCom DB SQL does not guarantee the sort order of rows unless the SELECT statement includes an ORDER BY clause.
Syntax
ORDER BY { expr | posn } [ ASC | DESC ]
[ , { expr | posn } [ASC | DESC] , ... ]
Notes
Note: This is a non-standard SQL feature as specified by SQL92. Also, full cursor update is not supported by FairCom DB SQL.
For example:
-- Get a merged list of customers and suppliers
-- sorted by their name.
(SELECT name, street, state, zip
FROM customer
UNION
SELECT name, street, state, zip
FROM supplier)
ORDER BY 1 ;
(SELECT name, street, state, zip
FROM customer
UNION
SELECT name, street, state, zip
FROM supplier)
ORDER BY customer.name;
Example
SELECT name, street, city, state, zip
FROM customer
ORDER BY name ;