1. 程式人生 > >三十、 ORACLE WITH AS 用法

三十、 ORACLE WITH AS 用法

                ORACLE WITH AS 用法

With查詢語句不是以select開始的,而是以“WITH”關鍵字開頭
可認為在真正進行查詢之前預先構造了一個臨時表,之後便可多次使用它做進一步的分析和處理

--相當於建了個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;