SQL Cheat Sheet/Full outer join

Return matched and unmatched rows from both tables.

Section: Joins

Full outer join

sql
sql
SELECT a.id AS a_id, b.id AS b_id
FROM a
FULL OUTER JOIN b ON b.id = a.id;
Explanation

Useful for reconciliation queries.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Joins
Inner join two tables
Return rows with matches in both tables.
OpenIn sheetsqlsame section
Left join
Keep all rows from the left table and match rows from the right table.
OpenIn sheetsqlsame section
Right join
Keep all rows from the right table.
OpenIn sheetsqlsame section
Self join
Join a table to itself.
OpenIn sheetsqlsame section
Cross join
Return the Cartesian product of two sets.
OpenIn sheetsqlsame section
Select all columns
Return all columns from a table.