-
Notifications
You must be signed in to change notification settings - Fork 0
SQL Tips
Praveen Kumar Anwla edited this page Feb 15, 2025
·
1 revision
MySQL doesn't support the FULL OUTER JOIN
syntax directly. However, you can simulate it by combining a LEFT JOIN
and a RIGHT JOIN
using UNION
(or UNION ALL
if you want to keep duplicates). For example:
SELECT *
FROM table1
LEFT JOIN table2 ON table1.common_column = table2.common_column
UNION
SELECT *
FROM table1
RIGHT JOIN table2 ON table1.common_column = table2.common_column;
This query returns all rows from both tables, matching rows where possible, and including non-matching rows from both sides.