MENU

order by的用法

June 8, 2018 • Read: 153 • SQL

order by【以某个字段排序】
select * from emp order by sal--默认按照升序排序
select * from emp order by deptno,sal--先按照deptno排升序,deptno相同则按照sal排升序
select * from emp order by deptno desc,sal--先按照deptno排降序,deptno相同则按照sal排升序
select * from emp order by deptno,sal desc--先按照deptno排升序,然后按照sal排降序
select * from emp order by deptno desc,sal desc--先按照deptno排降序,然后按照sal排降序
最后编辑于: August 27, 2018
Archives Tip
QR Code for this page
Tipping QR Code