oracle分页

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

oracle分页查询(查询第六到第十条数据),分步解析

1,select * from emp;

2,select a1.*,rownum rn from ((select * from emp) a1);

3,select a1.*,rownum rn from ((select * from emp) a1) where rownum<=10;

4,select * from (select a1.*,rownum rn from ((select * from emp) a1) where rownum<=10) where rn>=6;

 

SQL> select * from (select a1.*,rownum rn from ((select * from emp) a1) where rownum<=10) where rn>=6;
 
EMPNO ENAME      JOB         MGR HIREDATE          SAL      COMM DEPTNO         RN
----- ---------- --------- ----- ----------- --------- --------- ------ ----------
 7698 BLAKE      MANAGER    7839 1981-5-1      2850.00               30          6
 7782 CLARK      MANAGER    7839 1981-6-9      2450.00               10          7
 7788 SCOTT      ANALYST    7566 1987-4-19     3000.00               20          8
 7839 KING       PRESIDENT       1981-11-17    5000.00               10          9
 7844 TURNER     SALESMAN   7698 1981-9-8      1500.00      0.00     30         10