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
SQL COALESCE vs ISNULL: Key Differences
By Sharon Ben-Moshe · Aug 26, 2026
Compare SQL COALESCE and ISNULL: argument count, portability, return types, nullability, evaluation behavior, and the MySQL naming trap.
Read postSQL ROW_NUMBER(): How to Number Rows
By Sharon Ben-Moshe · Aug 26, 2026
Learn SQL ROW_NUMBER with practical examples for numbering rows, latest-row-per-group queries, tie-breaking, and when RANK is the better choice.
Read postTry it now
Paste your SQL into sqlfmt — format, validate, and catch typos free in your browser.