SQL> select empno,dname from emp , dept where
emp.deptno = dept.deptno(+);--显示emp全部的行,相当于左外连接。
EMPNO DNAME
---------- --------------
7369 RESEARCH
7499 SALES
7521 SALES
7566 RESEARCH
7654 SALES
7698 SALES
7782 ACCOUNTING
7788 RESEARCH
7839 ACCOUNTING
7844 SALES
7876 RESEARCH
7900 SALES
7902 RESEARCH
7934 ACCOUNTING
14 rows selected.
SQL> select empno,dname from emp , dept where emp.deptno(+) = dept.deptno;--显示dept全部的行,相当于右外连接。
EMPNO DNAME
---------- --------------
7782 ACCOUNTING
7839 ACCOUNTING
7934 ACCOUNTING
7566 RESEARCH
7902 RESEARCH
7876 RESEARCH
7369 RESEARCH
7788 RESEARCH
7521 SALES
7844 SALES
7499 SALES
7900 SALES
7698 SALES
7654 SALES
OPERATIONS
15 rows selected.
分析如下:(+) 那边使用+号就以想对的库表为基准
EMPNO DNAME
---------- --------------
7369 RESEARCH
7499 SALES
7521 SALES
7566 RESEARCH
7654 SALES
7698 SALES
7782 ACCOUNTING
7788 RESEARCH
7839 ACCOUNTING
7844 SALES
7876 RESEARCH
7900 SALES
7902 RESEARCH
7934 ACCOUNTING
14 rows selected.
SQL> select empno,dname from emp , dept where emp.deptno(+) = dept.deptno;--显示dept全部的行,相当于右外连接。
EMPNO DNAME
---------- --------------
7782 ACCOUNTING
7839 ACCOUNTING
7934 ACCOUNTING
7566 RESEARCH
7902 RESEARCH
7876 RESEARCH
7369 RESEARCH
7788 RESEARCH
7521 SALES
7844 SALES
7499 SALES
7900 SALES
7698 SALES
7654 SALES
OPERATIONS
15 rows selected.
分析如下:(+) 那边使用+号就以想对的库表为基准