关于Oracle分页查询
--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<=6)t2 where rn>=4;
--第一层:
--select * from emp ..
--第二层:
--select * from (第一层) where rownum <=6(endNum);
--第三层:
--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<=10)t2 where rn>=7;
---------------合并查询
------union
------union all
------intersect
相关推荐
oraclemch 2020-11-06
Seandba 2020-08-16
dbasunny 2020-08-16
娜娜 2020-06-22
专注前端开发 2020-10-21
苏康申 2020-11-13
vitasfly 2020-11-12
liuyang000 2020-09-25
FellowYourHeart 2020-10-05
赵继业 2020-08-17
whyname 2020-08-16
拼命工作好好玩 2020-08-15
langyue 2020-08-15
写程序的赵童鞋 2020-08-03
Accpcjg 2020-08-02
tydldd 2020-07-30
好记忆也需烂 2020-07-28