各位如果看到博客内有广告,可以动手点一点,谢谢

MENU

order by的用法

June 8, 2018 • Read: 329 • 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排降序
Archives Tip
QR Code for this page
Tipping QR Code