Definition:
You can sort the results of a SQL query by any field in an ascending (ASC) or descending (DESC) order by using the 'ORDER BY' clause at the end of a query.
For example, if the users table contained the names "Frank Miller, Mary Anderson, Jane Wilson, and John Chatsworth", you could use this for results sorted in an ascending order:
SELECT * FROM users
ORDER BY last_name ASC;
This would produce output like this:
Mary Anderson
John Chatsworth
Frank Miller
Jane Wilson
or you could use this for results sorted in a descending order:
SELECT * FROM SELECT * FROM users
ORDER BY last_name DESC;
This would produce output like this:
Jane Wilson
Frank Miller
John Chatsworth
Mary Anderson
Related Links:
Related Code Snippets:
- String Functions: ASCII - Returns the ASCII number code that represents the specified character.

- Generate ASCII table - Generates the full ASCII table. Useful for reference or decoding, testing, etc.

- ASCIISTR - ASCIISTR takes as its argument a string, or an expression that resolves to a string, in...
