What is FULL OUTER JOIN?
FULL OUTER JOIN shows ALL rows from BOTH tables, whether they match or not.
Simple rule: Everyone is shown, matched or not!
How FULL OUTER JOIN Works
Basic Syntax
SELECT columns
FROM table1
FULL OUTER JOIN table2 ON table1.id = table2.foreign_id;Example: All Students and All Orders
SELECT students.name, orders.product
FROM students
FULL OUTER JOIN orders ON students.id = orders.student_id;Result:
- John - Books (matched)
- Mary - NULL (no order)
- Peter - NULL (no order)
- NULL - Phone (no student)
JOIN Comparison
- INNER → Only matches
- LEFT → All left + matches
- RIGHT → All right + matches
- FULL OUTER → ALL from both sides
Try It Below
Practice with pre-joined FULL OUTER JOIN results!
What Comes Next
Next: Self Join - join a table to itself!