SQL FULL OUTER JOIN: MySQL Workaround & Examples
By Sharon Ben-Moshe · August 26, 2026 · 2 min read
Sharon Ben-Moshe is the founder of sqlfmt, a browser-based SQL formatter and validator with misspelled-keyword suggestions across PostgreSQL, MySQL, SQLite, SQL Server, and BigQuery.
Learn SQL FULL OUTER JOIN results, syntax across databases, NULL handling, and a MySQL workaround using LEFT JOIN, RIGHT JOIN, and UNION ALL.
Quick answer
A FULL OUTER JOIN returns matching rows plus unmatched rows from both inputs, using NULL for the missing side. PostgreSQL, SQL Server, SQLite, and BigQuery support FULL OUTER JOIN; MySQL needs a UNION ALL workaround that adds right-only rows after a LEFT JOIN.
FAQs
What is a FULL OUTER JOIN?
A FULL OUTER JOIN returns every matching row plus unmatched rows from both input tables. Columns from the missing side are NULL for an unmatched row, so the result is the union of matched, left-only, and right-only rows.
Does MySQL support FULL OUTER JOIN?
MySQL’s documented JOIN syntax does not provide a FULL OUTER JOIN keyword. A common equivalent is a LEFT JOIN combined with right-only rows from a RIGHT JOIN using UNION ALL, with a non-null left key used to identify those unmatched rows.
Why use UNION ALL in a MySQL full join workaround?
The first LEFT JOIN branch contains all matches and left-only rows. The second branch is filtered to right-only rows, so UNION ALL combines two non-overlapping sets without the extra duplicate-elimination work performed by UNION.
Can a WHERE clause break a FULL OUTER JOIN?
Yes. A WHERE predicate on a column from one joined table can discard rows where that table is NULL, defeating the outer join. Put matching conditions in ON, and write any NULL-aware post-join filter deliberately.
Keep reading
The Comprehensive Guide to SQL Data Types: Storage, Precision, and Cross-Dialect Portability
By Sharon Ben-Moshe · Oct 13, 2026
The complete guide to SQL data types across PostgreSQL, MySQL, SQL Server, and SQLite. Numeric precision, character sets, timestamps, and JSON.
Read postThe Definitive Guide to SQL Window Functions: Syntax, Framing, and Real-World Recipes
By Sharon Ben-Moshe · Oct 13, 2026
The comprehensive guide to SQL window functions. Master OVER, PARTITION BY, ORDER BY, window frames (ROWS vs RANGE), and ranking recipes.
Read postTry it now
Paste your SQL into sqlfmt — format, validate, and catch typos free in your browser.