Oracle分页查询rownum与row_number() o

2019-06-12  本文已影响0人  如果不是废物谁又愿混吃等死

row_number() over()
...

select *
from (select *
      from (select b.*, row_number() over(order by bookid) as rownumber
              from (select * from book) b)
     where rownumber > 0)
 where rownum <= 8;

...

...

select *
from (select *
      from (select b.*, row_number() over(order by bookId) as rownumber
              from (select * from book) b))
 where rownumber >= 0  and  rownumber <= 10;

...

rownum

...

 select *
  from (select b.*, rownum as rn
      from (select * from book order by bookId) b
     where rownum <= 8)
  where rn > 0;

...

...

select *
from (select b.*, rownum as rn from (select * from book order by bookId) b)
 where rn >= 0 and rn <= 10;

...

上一篇下一篇

猜你喜欢

热点阅读