關於Oracle表串連

來源:互聯網
上載者:User

關於Oracle表串連

Oracle表串連注意left join on與where的區別:

select * from dept;

select * from emp;

select * from emp a right outer join dept b on a.deptno=b.deptno where a.empno is null;

select b.deptno,a.* from emp a right join dept b on a.deptno=b.deptno and a.empno is null;

這裡注意oralce執行順序:

第一個語句(where):

1.找到主表和串連表的交集記錄;

2.將主表記錄和交集記錄合并;

3.對合并的記錄執行where 子句過濾;

第二個語句:

1.找到主表和串連表中empno為空白的記錄做交集處理;

2.將主表記錄和交集記錄合并;

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.