order by 关键字
作用:用于对查询结果进行排序
select * from emp where deptno = 20 order by sal asc /desc;
如何排序之升降问题
*用关键字: sal(升序)select * from emp where deptno = 20 order by sal asc
desc(降序)select * from emp where deptno = 20 order by sal desc;
*sal为默认操作,不写也可以;
如果排序的列值相同时,如何处理?
select * from emp where deptno = 20 order by sal desc,ename desc
*先排整体再排局部