爲了方便查看數據,能夠對數據進行排序spa
select * from 表名 order by 列1 asc|desc,列2 asc|desc,...
將行數據按照列1進行排序,若是某些行列1的值相同時,則按照列2排序,以此類推code
默認按照列值從小到大排列blog
asc從小到大排列,即升序排序
desc從大到小排序,即降序class
select * from students where gender=1 and isdelete=0 order by id desc;
select * from students where gender=1 and isdelete=0 order by id desc;