Oracle分頁查詢

2021-06-12 05:24:30 字數 884 閱讀 8715

--建表

create table dinya_test 

( transaction_id number primary key, 

item_id number(8) not null, 

item_description varchar2(300), 

transaction_date date 

--插入資料

insert into dinya_test values(1, 12, 'books',sysdate); 

insert into dinya_test values(2, 12, 'books',sysdate+30); 

insert into dinya_test values(3, 12, 'books',to_date('2005-05-30','yyyy-mm-dd')); 

insert into dinya_test values(4, 12, 'books',to_date('2007-06-23','yyyy-mm-dd')); 

insert into dinya_test values(5, 12, 'books',to_date('2011-02-26','yyyy-mm-dd')); 

insert into dinya_test values(6, 12, 'books',to_date('2011-04-30','yyyy-mm-dd')); 

commit; 

分頁查詢

select * from (

select row_number() over(order by transaction_id desc)  rn, test.* 

from dinya_test test

)where rn between 1 and 3

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...