Oracle数据库分页的三种方法
生活随笔
收集整理的這篇文章主要介紹了
Oracle数据库分页的三种方法
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
-- 不能對ROWNUM使用>(大于1的數值)、>=(大于或等于1的數值)、=(大于或等于1的數值),否則無結果
-- 所以直接用只能從1開始
-- rownum >10 沒有記錄,因為第一條不滿足去掉的話,第二條的rownum又成了1,所以永遠沒有滿足條件的記錄。
select * from student where rownum>=1;
--如果想要用rownum不從1開始,需按下面方法使用
select a1.* from (select student.*,rownum rn from student) a1 where rn >5;
--分頁查詢一
select * from (select a1.*,rownum rn from (select * from student) a1 where rownum <=5) where rn>=2;
--分頁查詢二
select a1.* from (select student.*,rownum rn from student where rownum <=5) a1 where rn >=3;
--分頁查詢三
select a1.* from (select student.*,rownum rn from student) a1 where rn between 3 and 5;
總結
以上是生活随笔為你收集整理的Oracle数据库分页的三种方法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Word怎么将一个文档拆分成几个小文档
- 下一篇: 泰拉瑞亚怎么打世纪之花(汉典泰字的基本解