oracle with as 缺点 oracle with as区别和用法?
oracle with as区别和用法?With as 就是将一个子查询的结果作为一张临时表,下面接着写select语句可以通过别名直接使用语法:针对一个别名with tmp as (select
oracle with as区别和用法?
With as 就是将一个子查询的结果作为一张临时表,下面接着写select语句可以通过别名直接使用
语法:
针对一个别名
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),
…
例子:
--相当于建了个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