The ORDER BY keyword is used to sort the data in a recordset.
The ORDER BY Keyword
The ORDER BY keyword is used to sort the data in a recordset.
The ORDER BY keyword sort the records in ascending order by default.
If you want to sort the records in a descending order, you can use the DESC keyword.
Syntax
SELECT column_name(s)
FROM table_name ORDER BY column_name(s) ASC|DESC |
To learn more about SQL, please visit our SQL tutorial.
Example
The following example selects all the data stored in the "Persons" table, and sorts the result by the "Age" column:
|