Left Outer Join

The concept of Left Outer Join is similar and same to the Left Join, and both these terms are interchangeably used. The keyword used here is “Outer“, which is optional and also doesn’t impact the result.

Let’s see the syntax of Left Outer Join:

Syntax

SELECT columns

FROM left_table

LEFT OUTER JOIN right_table ON

join_condition;

Example:

Let’s consider the same tables used in the above Left Join Example:

Query for Left Outer Join

SELECT Customer_Data.customer_id, Customer_Data.customer_name,
Orders_Data.order_id, Orders_Data.order_date FROM Customers_Data
LEFT OUTER JOIN Orders ON
Customers_Data.customer_id = Orders_Data.customer_id;

Result/Output

customer_id

customer_name

order_id

order_date

1

Gaurav

1

2023-01-23

1

Gaurav

2

2023-02-03

2

Anjali

NULL

NULL

3

Ramesh

3

2023-03-05

4

NULL

NULL

NULL

Explanation

In the above example, non-matching records from the right table (“Orders_Data“) are included, and NULL values are shown for the right table columns. Thus, the customer with ‘customer_id 4 in the Orders_Data table, which doesn’t have a matching record in the Customer_Data table is also included in the result set and the NULL values are shown, which was not displayed in the Left Join condition.

Difference Between Left Join and Left Outer Join

Database in any computer system is the collection of structured or unstructured data that can be used to perform various options like creation, deletion, etc. This database is managed by a special language known as SQL. In SQL language there are different joins that are used to assemble rows from two or more tables from the related column. Some of the joins are Inner Join, Left Join, and Right Join. In this article, we will explore the concepts with examples of Left Join and Left Outer Join. Along with this, we will also go through their main differences.

Similar Reads

Left Join

Left Join in SQL language is used to return all the data or records from the left table and the matching data or records from the right table. In the scenario, where there is no match, then the join still consists of the rows from the left table and displays the NULL values for the columns of the right table....

Left Outer Join

The concept of Left Outer Join is similar and same to the Left Join, and both these terms are interchangeably used. The keyword used here is “Outer“, which is optional and also doesn’t impact the result....

Difference Between Left Join and Left Outer Join

Parameter Left Join Outer Join Matching Records In Left Join, matching records from the right table are included. In Left Outer Join, matching records from the right tables are included. Non-Matching Records In Left Join, non-matching records from the rightmost table are excluded. In Left Outer Join, non-matching records from the right table are included and the NULL value is displayed for the right table columns. Join Keyword LEFT JOIN LEFT OUTER JOIN Null Values No NULL values are shown for the right table columns. NULL values are shown for the right table columns in case there is no match. Syntax SELECT columns FROM left_table LEFT JOIN right_table ON join_condition; SELECT columns FROM left_table LEFT OUTER JOIN right_table ON join_condition;...

FAQs on Left Join and Left Outer Join

1. When should we use a Left Join?...