oracle rownum use paging paging mode

Basics: rownum only do <or <= query conditions, if you want to be 51 to rownum 100 determines such a range, the need to query rownum each line, and then making a judgment that the number

Get Data 51-100 of
three kinds of paging wording:
1. Use the minus, the principle is the data line 100 before the check out line 50 minus the data before check out

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

2. rownum check out all the data, and then select the data 50-100 (not recommended)

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

3. The data defining the range of 100, 100 and check out that the rownum, and then select the data of 50 to 100

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

Guess you like

Origin blog.51cto.com/zhencoolgirl/2442236