SQL Keyword - FULL OUTER JOIN

FULL OUTER JOIN Keyword

The Full Outer Join Keyword is used to combine two tables and returns all matching records from both tables, whether the other table matches or not.

Syntax

SELECT * FROM <TABLE1>
FULL OUTER JOIN <TABLE2> ON <TABLE1>.<COLUMN_NAME>=<TABLE2>.<COLUMN_NAME>

Example

SELECT * FROM Employee
FULL OUTER JOIN Department ON Employee.Dept_Id = Department.Dept_Id

If there are no matching records in the right table, only the left table value is displayed, and null values are substituted for the right table value. And if there are no matching records in the left table, only the right table value is displayed, and null values are substituted for the left table value.

Summary

The FULL OUTER JOIN clause returns a result set that includes rows from both the left and right tables.

Next Recommended Reading Top Keyword in SQL