order by 升序和降序排列显示
SQL 语句中, asc 指定列按升序排列,desc 指定列按降序排列。
排序子句语法:order by 列名 asc / desc
例表格:tablename
1、 按列 c2 的升序排列
select * from tablename order by c2 asc;
2、 按列 c2 的降序排列
select * from tablename order by c2 desc;
3、 复合排序,先按列 c1 升序排列,再按 c2 降序排列
select * from tablename order by c1 asc, c2 desc;