SQL Full Join

A FULL JOIN returns every row from both tables, matching them where it can and using NULL on whichever side has no counterpart.

What FULL JOIN does

A FULL JOIN (also written FULL OUTER JOIN) combines the behavior of the left and right joins. Every row from both tables is guaranteed to appear. Where a row on one side matches a row on the other, they are joined together. Where a row has no match, it still appears, with the columns from the other table filled with NULL. This gives you the complete picture, including records that exist on only one side.

All customers and all orders together

SELECT Customers.CustomerName, Orders.OrderID, Orders.Amount
FROM Customers
FULL JOIN Orders
  ON Customers.CustomerID = Orders.CustomerID;

The result contains matched pairs (Anita Rao's two orders and Ben Carter's one), customers with no orders (Chloe Dubois and Diego Alvarez, with NULL order data), and orders with no customer (order 104, with a NULL customer name). Nothing from either table is left out.

CustomerNameOrderIDAmount
Anita Rao101250
Anita Rao10290
Ben Carter103400
Chloe DuboisNULLNULL
Diego AlvarezNULLNULL
NULL104150
Note: MySQL does not support FULL JOIN directly. A common workaround is to combine a LEFT JOIN and a RIGHT JOIN with UNION, which produces the same complete result set.

When a full join is the right choice

Reach for a FULL JOIN when you need to reconcile two data sets and must see everything, including mismatches on either side. Filtering for rows where either key is NULL is a quick way to audit both orphaned orders and inactive customers in a single query.

Finding mismatches on either side

SELECT Customers.CustomerName, Orders.OrderID
FROM Customers
FULL JOIN Orders
  ON Customers.CustomerID = Orders.CustomerID
WHERE Customers.CustomerID IS NULL
   OR Orders.CustomerID IS NULL;
  • A FULL JOIN keeps unmatched rows from both tables.
  • Missing values on either side are filled with NULL.
  • It is essentially a LEFT JOIN and a RIGHT JOIN merged into one result.
  • Use it for reconciliation and data-quality checks across two tables.