ORDER BY
Keyword
The ORDER BY keyword is used to sort the result.
An Orders is given on the right: |
|
To display the companies in alphabetical order:
|
|
To display the companies in alphabetical order AND the ordernumbers in numerical order:
|
|
To display the companies in reverse alphabetical order:
|
|
To display the companies in reverse alphabetical order AND the ordernumbers in numerical order:
|
|
Customers
table may be created by the following command:
SQL> create table Customers ( 2 CustomerID varchar(16), 3 CompanyName varchar(32), 4 ContactName varchar(32), 5 Address varchar(64), 6 City varchar(32), 7 PostalCode varchar(16), 8 Country varchar(32) );Note that the
Customers
table is for read only.