#1 Data Analytics Program in India
₹2,499₹1,499Enroll Now
Step 9
4 min read

FULL OUTER JOIN

Get ALL records from BOTH tables - nothing is hidden.

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!

FULL OUTER JOIN Result

Everyone shown! Peter='None' (no order), 'Unknown'=Phone (no student).

Source Table: students
nameproductamount
JohnBooks50
MaryLaptop800
PeterNone0
UnknownPhone500
4 rows
SQL Editor
Loading...

Filter Results

Find orders over 100. Try: SELECT name, product FROM joined_data;

Source Table: students
nameproductamount
JohnBooks50
MaryLaptop800
PeterNone0
UnknownPhone500
4 rows
SQL Editor
Loading...

Finished this topic?

Mark it complete to track your progress and maintain your streak!

SkillsetMaster - AI, Web Development & Data Analytics Courses