SQL Server › Joins

What is a FULL OUTER JOIN, and when would you use one instead of a LEFT or RIGHT JOIN?

Intermediate

Answer

A FULL OUTER JOIN returns all rows from both tables, matching them where possible and filling in NULL values on either side when no match exists, which is useful when you need to see the complete picture from both tables, including unmatched rows from either side, rather than favoring one table over the other.
SELECT c.Name, o.OrderId
FROM Customers c
FULL OUTER JOIN Orders o ON c.CustomerId = o.CustomerId;
Real-world example A data reconciliation report uses a FULL OUTER JOIN to compare two systems, showing customers with no matching orders and orders with no matching customers, helping identify data inconsistencies in either direction.

Common follow-ups: How common is FULL OUTER JOIN compared to INNER and LEFT JOIN in typical applications?;What does the result look like for rows that match in both tables?