文章詳情頁
oracle 數(shù)據(jù)分頁查詢
瀏覽:54日期:2023-11-14 15:37:01
1. 最好還是利用分析函數(shù)row_number() over ( partition by col1 order by col2 )比如想取出100-150條記錄,按照tname排序select tname,taBType from ( select tname,tabtype,row_number() over ( order by tname ) rn from tab)where rn between 100 and 150;2. 直接使用rownum 虛列select tname,tabtype from ( select tname,tabtype,rownum rn from tab where rownum <= 150)where rn >= 100;使用序列不能基于整個(gè)記錄集合進(jìn)行排序,假如指定了order by子句,排序的的是選出來的記錄集的排序.------------------------------------------------------------------------經(jīng)過我的測(cè)試,在100萬條數(shù)據(jù)的表中,檢索數(shù)據(jù)的時(shí)候,方法2的速度要比方法1要快的.
標(biāo)簽:
Oracle
數(shù)據(jù)庫
排行榜