1.desc是descend 降序意思 ,asc 是ascend 升序意思,
2.与order by 一起用
/*在分数表里查询答案和分数两列,按分数从大到小排列(降序)*/
select answer, scores from assess_score order by scores desc
/*在分数表里查询答案和分数两列,按分数从小到大排列(升序)*/
select answer, scores from assess_score order by scores asc
/*在分数表里查询答案和分数两列,不加排序默认按分数从小到大排列(升序) ==asc
select answer, scores from assess_score order by scores
复合排序,先按列n1升序排列,再按n2降序排列
注意:如果采用多个字段排序,如果根据第一个字段排序重复了,会根据第二个字段排序;