打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
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;

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
oracle分页查询方法
分页查询
三大数据库分页方法(Oracle/MySQL/SQL)
oracle 按ROWID实现分页查询
Oracle分页查询的优化方案
Oracle分页小谈
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服