排序检索数据
1.按照某一列数据进行排序:select name,id from shopping order by id;
2.按照多列数据进行排序: select name,id from shopping order by id,name;
(这个排序是有一定的顺序,id在前就先按照id排序,如果id每一项都是唯一的,这个后面的排序规则就没用了)
3.按照降序进行排序:select name,id from shopping order by id desc;
4.设定多行排序规则,有些升序有些降序:select name,id from shopping order by name asc, id desc;
5.oder by和limit结合使用:select name,id from shopping order by id desc limit 3;
(limit必须要在order by的后面)