oracle分页查询

三种分页的写法:

1.使用minus,原理就是查询出前100行的数据 减去 查询出前50行的数据

1
2
3
select * from DATA_TABLE_SQL where rownum<=100
minus
select * from DATAT_ABLE_SQL where rownum<=50

2.查询出所有数据的rownum,然后再选择50到100的数据(不推荐)

1
2
select * from (select t.*,rownum num from DATA_TABLE_SQL t)
where num<=100 and num>50

3.限定范围100条数据,并查询出这100条的rownum,然后再选择50到100的数据

1
2
3
select * from
(select t.*,rownum num from DATA_TABLE_SQL t where rownum<=100 )
where num>50
posted @ 2020-06-09 10:42  EricDo  阅读(279)  评论(0)    收藏  举报