OUTER JOIN
or FULL OUTER JOIN
returns all the records from the selected fields between the two tables (left table & right table) whether the join condition is met or not.
INNER JOIN
and an OUTER JOIN
is that the INNER JOIN
only returns the information from both tables which are common and related to each other. The OUTER JOIN will return all rows (matched/unmatched) from both tables.
SELECT column_1, column_2...
defines the columns from both tables where we want to display data.FROM table_1
represents the left table with table_1 in the FROM clause.FULL OUTER JOIN table_2
represents the right table with table_2 in the FULL OUTER JOIN condition.ON table_1.matching_field = table2.matching_field
sets the join condition after the ON keyword with the matching field between the two tables. NULL
values will return in every column of the table that doesn’t have the matching record.OUTER JOIN
query as follows:
FULL OUTER JOIN
with WHERE
ClauseWHERE
clause and NULL
as the following query: