Skip to main content

What does FULL OUTER JOIN do?

FULL OUTER JOIN combines the results of LEFT JOIN and RIGHT JOIN - it returns all rows from both tables, even when there's no match between them.

Where there's a match, the rows are merged. Where there isn't, the missing columns come back as NULL.

Example

sql
SELECT * FROM customers FULL OUTER JOIN orders ON customers.id = orders.customer_id;

Result:

  • customers with orders: merged;
  • customers without orders: NULL on the orders side;
  • orders without customers: NULL on the customers side.

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.