trainingtrains Logo

91-9990449935

 0120-4256464

PostgreSQL Outer Join

The Outer Join is an extension of Inner Join. There are three types of Outer Joins.

  • Left Outer Join
  • Right Outer Join
  • Full Outer Join

Left Outer Join:

The left outer join returns all rows from the left hand table specified in the "ON" condition and only rows from the other table where the condition is fulfilled.

Image representation:

PostgreSQL left join1

Syntax:

See this example:

Let's take a table "EMPLOYEES" having the following data.

Table1: EMPLOYEES

PostgreSQL left join2

Create another table "DEPARTMENT" having the following data.

Table2: DEPARTMENT

PostgreSQL left join3

Execute the following query:

Output:

PostgreSQL left join4