对查询结果进行排序
- 单列排序
- 语法:SELECT *FROM table_name WHERE col_name ORDER BY [ASC]|DESC
- 特点:ASC升序排列(默认),DESC降序排列
- 例子:SELECT *FROM games
WHERE GName=’p’
ORDER BY GNO DESC
多列排序
-语法: SELECT *FROM table WHERE col_name ORDER BY col2_name ASC,col3_name DESC
-特点:多列排序需要考虑优先级问题,ORDER BY 后面的字段优先级依次降低
-例子:SELECT *FROM table1 ORDER BY tadt DESC,number ASC