February 2014
Beginner
1248 pages
62h 25m
English
The rows in the result of a query can be sorted into ascending or descending order by using the optional ORDER BY clause. The basic form of a query with an ORDER BY clause is
SELECT columnName1, columnName2, ... FROM tableName ORDER BY column ASCSELECT columnName1, columnName2, ... FROM tableName ORDER BY column DESC
where ASC specifies ascending order (lowest to highest), DESC specifies descending order (highest to lowest) and column specifies the column on which the sort is based. For example, to obtain the list of authors in ascending order by last name (Fig. 24.15), use the query
SELECT AuthorID, FirstName, LastName FROM Authors ORDER BY LastName
Read now
Unlock full access