This statement is used to order the result set of a query by the specified field.
1 2 3 | SELECT attr_expr_list FROM table_reference ORDER BY col_name [ASC | DESC] [,col_name [ASC | DESC],...]; |
The to-be-sorted table must exist. If this statement is used to sort a table that does not exist, an error is reported.
To sort table student in ascending order according to field score and return the sorting result, run the following statement:
1 2 | SELECT * FROM student ORDER BY score; |