您的位置:首页 > 数据库 > Oracle

oracle 分页查询

2017-06-11 12:26 375 查看
rownum的使用

1第一个查询中,rownum只能使用<=,<

2每个查询中rownum只能使用一次

–如果想要用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 <=10) where rn>=6;

--分页查询二

select a1.* from (select student.*,rownum rn from student where rownum <=10 )a1 where rn >=6;

--分页查询三
select a1.* from (select student.*,rownum rn from student) a1 where rn between 6 and 10;


内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: