Left and Right Outer Joins : Outer Joins Left Right « Table Joins « Oracle PL/SQL Tutorial






Outer joins can be split into two types:

  1. Left outer joins
  2. Right outer joins

To understand the difference between left and right outer joins, consider the following syntax:

SELECT ...
FROM table1, table2
...

Assume the tables are to be joined on table1.column1 and table2.column2.

Assume table1 contains a row with a null value in column1.

To perform a left outer join, the WHERE clause is

WHERE table1.column1 = table2.column2 (+);

In a left outer join, the outer join operator is actually on the right of the equality operator.

Next, assume table2 contains a row with a null value in column2.

To perform a right outer join, you switch the position of the outer join operator to the left of the equality operator and the WHERE clause becomes WHERE table1.column1 (+) = table2.column2;

Depending on whether table1 and table2 both contain rows with null values, you get different results depending on whether you use a left or right outer join.

Quote from:

Oracle Database 10g SQL (Osborne ORACLE Press Series) (Paperback)

# Paperback: 608 pages

# Publisher: McGraw-Hill Osborne Media; 1st edition (February 20, 2004)

# Language: English

# ISBN-10: 0072229810

# ISBN-13: 978-0072229813









7.4.Outer Joins Left Right
7.4.1.Understanding Outer Joins
7.4.2.Left and Right Outer Joins
7.4.3.An Example of a Left Outer Join 1
7.4.4.An Example of a Left Outer Join 2
7.4.5.An Example of a Right Outer Join 1
7.4.6.An Example of a Right Outer Join 2
7.4.7.Perform outer joins in combination with self joins, employee and job tables
7.4.8.Example outer join with (+)
7.4.9.Right outer join with using statement
7.4.10.Right outer join with group by
7.4.11.LEFT OUTER JOIN tableName ON joined columns
7.4.12.LEFT OUTER JOIN vs RIGHT OUTER JOIN
7.4.13.Left Outer Join
7.4.14.Right Outer Join
7.4.15.Right Outer Join(room vs class)
7.4.16.Right join with where in clause