Server version: 5.6.47 MySQL Community Server (GPL)
1.排序数据
SELECT prod_name FROM Products;
SELECT prod_name FROM Products ORDER BY prod_name;
2.按多个列排序
SELECT prod_id,prod_price,prod_name FROM Products ORDER BY prod_price,prod_name;
3.按列位置排序
SELECT prod_id,prod_price,prod_name FROM Products ORDER BY 2,3;
4.指定排序方向
SELECT prod_id,prod_price,prod_name FROM Products ORDER BY prod_price DESC;
SELECT prod_id,prod_price,prod_name FROM Products ORDER BY prod_price DESC,prod_name;