开发工具与关键技术:PLSQL Developer开发工具 Oracle数据库
作者:罗中贤
撰写时间:2019-03-28

在Oracle数据库里找一组数据 ,Rownum 伪列,如下
如图:Rownum 伪列查询列前10到20的数据
第一步:查询一组相对多的数据

select  employee_id, salary 
from    employees
order by salary desc

输出:如图
Rownum 伪列查询列前10到20的数据
第二步:Rownum伪列

select rownum ,se.*from
(select  employee_id, salary 
from    employees
order by salary desc)se

还是没到我们想要的哪一步
Rownum 伪列查询列前10到20的数据
第三步:

select *from( select rownum r, se.*
              from(select  employee_id, salary 
                   from    employees
                   order by salary desc
                  ) se
            )
where r >10 and r<20

输出试试:
Rownum 伪列查询列前10到20的数据

相关文章: