![]() |
|
|
SQL explained: What is SQL | Select Statement | Select Where | Insert | Update/Edit | Delete | Order By | Select Between SQL ORDER BYThe ORDER BY clause allows you to sort the retrieved records. Syntax: SELECT * FROM TableName ORDER BY FieldName ASC/DESC The ASC keyword selects the results in ascending order. Ascending order is the default and the ASC keyword can be left out. The DESC keyword returns the results in descending order. If we wanted to select all the records in our database table below in Diagram1 and sort them in alphabetical order based on the FirstName field we could use the SQL statement below. SELECT * FROM Members_tbl ORDER BY FirstName
The first record retrieved would be the row with Dave Jones would lives
in 32 Donki Park in Belfast as Dave comes alphabetically before Henry
and Michael. SELECT * FROM Members_tbl ORDER BY FirstName DESC
Site developed by Michael Wall - Web Design Belfast N.Ireland. |
|