加入收藏 | 设为首页 | 会员中心 | 我要投稿 湖南网 (https://www.hunanwang.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长百科 > 正文

关于oracle with as用法

发布时间:2021-03-31 07:18:04 所属栏目:站长百科 来源:网络整理
导读:with as语法 –针对一个体名 with tmp as (select * from tb_name) –针对多个体名 with ?? tmp as (select * from tb_name), ?? tmp2 as (select * from tb_name2), ?? tmp3 as (select * from tb_name3), ?? … 1 2 3 4 5 6 7 8 9 --相等于建了个e姑且表 w
1 2 3 4 5 6 7 8 9 --相等于建了个e姑且表with? e as? (select? * from? scott.emp e where? e.empno=7499)select? * from? e; ? --相等于建了e、d姑且表with?????e as? (select? * from? scott.emp),?????d as? (select? * from? scott.dept)select? * from? e,d where? e.deptno = d.deptno;

着实就是把一大堆一再用到的sql语句放在with as内里,取一个体名,后头的查询就可以用它,这样对付大批量的sql语句起到一个优化的浸染,并且清晰明白。

向一张表插入数据的with as用法

1 2 3 4 5 insert? into? table2with????s1 as? (select? rownum c1 from? dual connect? by? rownum <= 10),????s2 as? (select? rownum c2 from? dual connect? by? rownum <= 10)select? a.c1,b.c2 from? s1 a,s2 b where...;

select s1.sid,s2.sid from s1,s2必要有关联前提,否则功效会是笛卡尔积。
with as 相等于假造视图。

(编辑:湖南网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

副问题[/!--empirenews.page--]

with as语法
–针对一个体名
with tmp as (select * from tb_name)

–针对多个体名
with
?? tmp as (select * from tb_name),
?? tmp2 as (select * from tb_name2),
?? tmp3 as (select * from tb_name3),
?? …

热点阅读