二.排序检索数据
- 按单个列排序
select prod_name
from products
order by prod_name;
- 按多个列排序
select prod_name,prod_id,prod_price
from products
order by prod_price,prod_name;
- 按列位置排序
select prod_id,prod_price,prod_name
from droduct
order by 2,3;
降序排序
desc只对它前面的那一列起作用,如果要每一列都降序排列则要在每一列后面都加desc
select prod_id,prod_price,prod_name
from droduct
order by prod_price desc,prod_name;