
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
Difference Between Left, Right and Full Outer Join
In this post, we will understand the difference between left outer join, right outer join, and full outer join.
Left Outer Join
It fetches all the rows from the table on the left.
It is same as ‘Inner Join + all the unmatched rows from the left table’.
The data that isn’t matched on the right table is lost.
Example:
SELECT [column_1, column_2, ….] FROM table_1 LEFT OUTER JOIN table_2 ON table_1.matching_column = table_2.matching_column
Right Outer Join
It fetches all the rows of the table on the right.
It is similar to performing ‘Inner Join + all of the unmatched rows from the right table’.
The unmatched data from the left table is lost.
Example:
SELECT [column_1, column_2, ….] FROM table_1 RIGHT OUTER JOIN table_2 ON table_1.matching_column = table_2.matching_column
Full Outer Join
It fetches all of the rows from both the tables.
It is similar to performing ‘Inner Join +all of the unmatched rows from the left table + all the unmatched rows from the right table’.
No data is lost during this operation.
Example:
SELECT [column_1, column_2, ….] FROM table_1 FULL OUTER JOIN table_2 ON table_1.matching_column = table_2.matching_column
- Related Articles
- INNER JOIN vs FULL OUTER JOIN vs LEFT JOIN vs RIGHT JOIN in PostgreSQL?
- Difference Between Inner Join and Outer Join in SQL
- Difference between Inner and Outer join in SQL
- Python - Merge Pandas DataFrame with Left Outer Join
- Difference Between Right and Left Lung
- Python - Merge Pandas DataFrame with Right Outer Join
- Difference Between CHF Left and CHF Right
- Compare two tables and return missing ids using MySQL LEFT OUTER JOIN
- How to perform a left outer join using linq extension methods in C#?
- What MySQL returns if I do not use the keyword ‘RIGHT’ or ‘LEFT’ while writing the query for RIGHT JOIN or LEFT JOIN?
- Find maximum difference between nearest left and right smaller elements in Python
- Find maximum difference between nearest left and right smaller elements in C++
- Difference between Join and union in SQL
- Usage and syntax of INNER and OUTER JOIN in DB2
- Difference Between Full Virtualization and Paravirtualization

Advertisements