关于Oracle分页查询
程序员文章站
2024-02-09 13:08:52
...
--MySql,分页 --select * from biaoming where tiaojian limit num1(start),num2(size) --------Oracle分页,关键字rownum --
--MySql,分页
--select * from biaoming where tiaojian limit num1(start),num2(size)
--------Oracle分页,关键字rownum
----
select ename,rownum from emp;
select ename,rownum from (select * from emp);
----三层过滤,,效率较高
select t2.* from (select t1.*, rownum rn from (select * from emp)t1 where rownum=4;
--第一层:
--select * from emp ..
--第二层:
--select * from (第一层) where rownum
--第三层:
--select * from (第二层) where rownum >=4(startNum);
--按照入职时间的顺序,查询从第7个到第10个人
select t2.* from (select t1.*, rownum rn from (select * from emp order by hiredate)t1 where rownum=7;
---------------合并查询
------union
------union all
------intersect