The SQL FULL OUTER JOIN combines two tables based on a common column and chooses records from both tables that match the values of the matching columns as well as any remaining rows.

In other words, the FULL OUTER JOIN in SQL combines the outcomes of both left and right outer joins and returns all rows from the tables on both sides of the join clause, whether they are matched or not.

However, MySQL doesn’t support the keywords FULL OUTER JOIN or FULL JOIN. Using LEFT and RIGHT JOINS, as illustrated below, we can still obtain both matched and unmatched records in accordance with the definition given above.

SELECT * FROM table1
LEFT JOIN table2 ON table1.id = table2.id
SELECT * FROM table1
RIGHT JOIN table2 ON table1.id = table2.id

Hope you find this article useful.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s