1. rownum 分頁
select * from emp;
2. 顯示rownum[oracle分配的]
select e.*, rownum rn from (select * from emp) e;rn相當於oracle分配的行的id號
3.挑選出6—10條記錄
先查出1-10條記錄
select e.*, rownum rn from (select * from emp) e where rownum <= 10;
如果後面加上rownum>=6是不行的,
4. 然後查出6-10條記錄
select * from (select e.*, rownum rn from (select * from emp) e where rownum <= 10) where rn >= 6;
5. 幾個查詢變化
a. 指定查詢列,只需要修改最裡層的子查詢
只查詢雇員的編號和工資
select * from (select e.*, rownum rn from (select ename, sal from emp)
e where rownum <= 10) where rn >= 6;
b. 排序查詢,只需要修改最裡層的子查詢
工資排序後查詢6-10條資料
select * from (select e.*, rownum rn from (select ename, sal from emp order
by sal) e where rownum <= 10) where rn >= 6;
ORACLE分頁查詢
單錶分頁 start num 起始行號 end num 截止行號 select t.from select s.rownum rn from table s where rownum end num t where rn start num 多表分頁 select from select temp....
Oracle分頁查詢
oracle的分頁查詢語句基本上可以按照本文給出的格式來進行套用。分頁查詢格式 select from select a.rownum rn from select from table name a where rownum 40 where rn 21 其中最內層的查詢select from t...
oracle 分頁查詢
1 要把rowid來分 select from t xiaoxi where rowid in select rid from select rownum rn,rid from select rowid rid,cid from t xiaoxi order by cid desc where r...