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:
NULLon theordersside; - orders without customers:
NULLon thecustomersside.
Short Answer
Interview readyPremium
A concise answer to help you respond confidently on this topic during an interview.