1.对指定列排序
单列排序要素:
(1)排序依据
(2)排序方式:升序、降序(ASC/DESC)
SELECT col_list FROM table _name
ORDER BY ordered_by_list [ASC/DESC]
示例:查询分数表中编号为1的所有分数信息,并按照分数升序排序
SELECT * FROM scores
WHERE GNO = 1
ORDER BY score ASC
2.多列排序
多列排序要素:
(1)排序依据
(2)排序方式
(3)优先级
SELECT col_list FROM table _name
ORDER BY ordered_by_list1 [ASC/DESC],ordered_by_list2 [ASC/DESC]...
示例:查询分数吧所有信息,并按照游戏编号的升序和分数的降序进行排序
SELECT * FROM scores
WHERE GNO = 1
ORDER BY gno ASC, score DESC
注:前面的优先级高