1. Syntax:
Select query list from table name "where filter condition" ORDER by the field or expression ordered by;
2. Features:
(1) ASC stands for Ascending, can be omitted; desc is the descending
(2) An ORDER BY clause can support a single field, alias, expression, function, multiple fields
(3) The ORDER BY clause at the end of the query statement, except the limit clause
3. Sort by a single field
SELECT * FROM Employees ORDER by salary DESC;
4. Add filter criteria and reorder
Case: Query the Employee information for department number >=90 and descending by employee number
5. Sort by expression
Case: Query employee information by annual salary descending
6. Sort by alias
Case: Query employee information by annual salary ascending
7. Sort by function
Case: Querying the Employee name and descending by the length of the name
8. Sort by multiple fields
Case: Query employee information, require first by salary descending, then press employee_id ascending
MySQL (v) dql sort Query