MySql FULL OUTER JOIN code example
Example 1: MySql FULL OUTER JOIN
-- MySql FULL OUTER JOIN
SELECT * FROM t1
LEFT JOIN t2 ON t1.id = t2.id
UNION ALL
SELECT * FROM t1
RIGHT JOIN t2 ON t1.id = t2.id
WHERE t1.id IS NULL
Example 2: full outer join sql
SELECT C.FirstName, C.LastName, C.Country AS CustomerCountry, S.Country AS SupplierCountry, S.CompanyName FROM Customer C FULL JOIN Supplier S ON C.Country = S.Country ORDER BY C.Country, S.Country
Example 3: full join
All part of the tables both matching portions
and unmatching portions from both tables.