oracle里 rownum 使用

oracle 输出5至10行
ruwnum 查询的时候只能使用< <= 等符号,不能使用 > 的符号,>= 很多情况下都不能使用,建议不要使用 >= 符号


--先查询10行的数据
select rownum, e.*
  from (select * from emp order by sal desc) e
 where rownum < 10;
--然后把这十行当成一个表,在表里面拿5-10行的数据 
select m2.*
  from (select rownum line, e.*
          from (select * from emp order by sal desc) e
         where rownum <= 10) m2
 where line > 5
   and line <= 10;

链接 详细 https://wenku.baidu.com/view/b67c28df770bf78a65295479.html
https://blog.csdn.net/qq_40794266/article/details/78698321

猜你喜欢

转载自blog.csdn.net/a520songhai/article/details/81002814