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

Home
Oracle PL/SQL Tutorial
1.Introduction
2.Query Select
3.Set
4.Insert Update Delete
5.Sequences
6.Table
7.Table Joins
8.View
9.Index
10.SQL Data Types
11.Character String Functions
12.Aggregate Functions
13.Date Timestamp Functions
14.Numerical Math Functions
15.Conversion Functions
16.Analytical Functions
17.Miscellaneous Functions
18.Regular Expressions Functions
19.Statistical Functions
20.Linear Regression Functions
21.PL SQL Data Types
22.PL SQL Statements
23.PL SQL Operators
24.PL SQL Programming
25.Cursor
26.Collections
27.Function Procedure Packages
28.Trigger
29.SQL PLUS Session Environment
30.System Tables Data Dictionary
31.System Packages
32.Object Oriented
33.XML
34.Large Objects
35.Transaction
36.User Privilege
Oracle PL/SQL Tutorial » Table Joins » Outer Joins Left Right 




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
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.