Joining Continued: Dept. of Computer Science Faculty of Science and Technology
Joining Continued: Dept. of Computer Science Faculty of Science and Technology
Joining Continued: Dept. of Computer Science Faculty of Science and Technology
No employee in the
OPERATIONS department
Outer Joins
You use an outer join to also see rows that do not
usually meet the join condition.
Outer join operator is the plus sign (+).
SELECT
SELECT table1.column,
table1.column, table2.column
table2.column
FROM
FROM table1,
table1, table2
table2
WHERE
WHERE table1.column(+)
table1.column(+) == table2.column;
table2.column;
SELECT
SELECT table1.column,
table1.column, table2.column
table2.column
FROM
FROM table1,
table1, table2
table2
WHERE
WHERE table1.column
table1.column == table2.column(+);
table2.column(+);
Using Outer Joins
SQL> SELECT e.ename, d.deptno, d.dname
2 FROM emp e, dept d
3 WHERE e.deptno(+) = d.deptno
4 ORDER BY e.deptno;
WORKER.ENAME||'WORKSFOR'||MANAG
WORKER.ENAME||'WORKSFOR'||MANAG
-------------------------------
-------------------------------
BLAKE
BLAKE works
works for
for KING
KING
CLARK
CLARK works
works for
for KING
KING
JONES
JONES works
works for
for KING
KING
MARTIN
MARTIN works
works for
for BLAKE
BLAKE
...
...
13
13 rows
rows selected.
selected.
Summary
SELECT
SELECT table1.column,
table1.column, table2.column
table2.column
FROM
FROM table1,
table1, table2
table2
WHERE
WHERE table1.column1
table1.column1 == table2.column2;
table2.column2;
Equijoin
Equijoin Non-equijoin
Non-equijoin Outer
Outer join
join Self
Self join
join
Books
1. https://www.db-book.com/db6/slide-dir/index.html
2. https://docs.oracle.com/en/database/oracle/oracle-database/20/sqlrf/SQL-
Standards.html#GUID-BCCCFF75-D2A4-43AD-8CAF-C3C97D92AC63
3. https://www.slideshare.net/HaaMeemMohiyuddin1/data-knowledge-and-
information
4. https://www.slideshare.net/tabinhasan/from-data-to-wisdom
5. https://www.slideshare.net/thinnaphat.bo/