方式一:
select * from (
select rownum r e.empno from ( select * from emp order by sal desc) e
)
where r>=5 and r<=8
注:在oracle中rownum永远是从1开始的,所以where条件不能 使用>、>=(比如:盖8层楼,1234层都没有盖,怎么能盖5678呢?大概就是这个意思。说的不对,赶紧提出来哦)
方式二:
select * from (
select rownum r,e1.empno from (select * from emp order by sal desc ) e1 where rownum<=8
) e2 where r>=5;