--效率低 select * from (select rownum rn, d.* from table d )p where p.rn<=20 and p.rn>=10; select * from (select rownum rn, d.* from table d )p where p.rn between 10 and 20; --效率高 select * from (select rownum rn, d.* from table d where rownum<=20 )p where p.rn>=10;
select * from (select rownum rn, d.* from table d where rownum<=20 )p where p.rn>=10; 为什么不直接用 select rownum rn, d.* from table d where rownum between 10 and 20 select * from (select rownum rn, t.* from ( select d.* from table d order by 1 desc )t where rownum<=20 )p where p.rn>=10;