Oracle Tutorial

What is Oracle
SQL Keywords

Oracle Wildcards

Oracle Wildcards

Oracle Aliases

Oracle Aliases

MySQL Tutorial

MySQL Tutorial

PL/SQL Tutorial

PL/SQL Tutorial

Oracle Interview Questions

Oracle Interview Questions and Answers


Oracle LEFT OUTER JOIN

In Oracle, LEFT JOIN is used to fetch all records from LEFT side table (tablename1) and only matching records from right side table (tablename2). It appears immediately after the FROM clause.

Oracle LEFT OUTER JOIN Syntax

To fetch all records from LEFT side table (tablename1) and only matching records from right side table (tablename2), use the following syntax:

Syntax

SELECT col1, col2,....
FROM tablename1
LEFT OUTER JOIN tablename2 
ON tablename1.col1 = tablename2.col1;

Parameters:

tablename1 & tablename2: The table name from which you want to fetch records.

col1: The column or field name that will be return.

Oracle LEFT OUTER JOIN example

The following Oracle, fetching all "accountName" fields value from "tblbankdemataccountcharges" table and only matching record from "banks" field from "tblbankheadquartersandaddress" table using LEFT OUTER JOIN, both have matching column values in tables :

Example

SELECT A.accountName, B.banks 
FROM tblbankdemataccountcharges A 
LEFT OUTER JOIN tblbankheadquartersandaddress B
ON A.bankId = B.pk LIMIT 6;

Note:

In the above example, we are fetching all "accountName" fields value from "tblbankdemataccountcharges" table only matching record from "banks" field from "tblbankheadquartersandaddress" table using LEFT OUTER JOIN, both have matching column values in tables.