T
Tech Town
Log InSign Up Free
← Back to Blog

August 2, 2025 · admin

What is FULL OUTER JOIN in SQL? Explained Simply

If you’re learning SQL joins, chances are you’ve already seen INNER JOIN, LEFT JOIN, and RIGHT JOIN. But there’s one more join type that often confuses beginners — FULL OUTER JOIN.

Let’s break it down in simple terms.


FULL OUTER JOIN: The Big Picture

A FULL OUTER JOIN returns all records from both tables, whether or not there is a match.

  • If a row in Table A has no match in Table B, you still get that row (with NULLs for B’s columns).
  • If a row in Table B has no match in Table A, you get that too (with NULLs for A’s columns).
  • If rows match, you get the combined result.

Think of it as a combination of:

  • LEFT OUTER JOIN
  • RIGHT OUTER JOIN
    = all data from both sides.

Syntax

SELECT *
FROM TableA
FULL OUTER JOIN TableB
ON TableA.id = TableB.id;

Visualizing It (Venn Diagram Style)

TableA     TableB
  ●───────●
 ┌──────────────┐
 │ A ⋈ B (both) │  ← Matching rows
 │     A only   │  ← Left-only rows (nulls from B)
 │     B only   │  ← Right-only rows (nulls from A)
 └──────────────┘

Use Cases

  • When you want all data from two tables — matches and non-matches.
  • Example: Merging customer orders and returns — including customers who never returned anything, and returns with no order record.

Final Tip :

While FULL OUTER JOIN wasn’t deeply demoed in lectures, the concept was covered in summaries and diagrams. The instructor mentioned:

“If needed later, we’ll revisit it with examples where FULL OUTER JOIN is best used.”

So keep the idea clear:

FULL OUTER JOIN = Everything from both sides, matched or not.


TL;DR

  • Keeps all data from both tables
  • NULLs where there’s no match
  • Good for merging full datasets

Share this post

WhatsApp LinkedIn Facebook X / Twitter Telegram