ORDER BY 语句
- 用于根据指定的列对结果集进行排序
- 默认按照升序(ASC)
Example,表名:orders
compoter | price |
---|---|
Lianxiang | 2200 |
HuaShuo | 2300 |
Apple | 4500 |
Lianxiang | 3000 |
//以字母顺序显示公司名字
select computer,price from orders order by computer
select computer,price from orders order by computer,price
//以字母顺序显示公司名字,降序
select computer,price from orders order by computer Desc
//已逆字母顺序显示公司名称,并以数字顺序显示顺序号:
select computer,price from orders order by computer Desc,price asc;