Resolved: CROSS JOIN vs. FULL OUTER JOIN
Hello,
I read that there is also a FULL OUTER JOIN in SQL, but the course doesn't have that in the lecture. So, is it the same with CROSS JOIN? If not, could you explain the difference between the two? Representing them in terms of Venn diagram would also help a lot.
Thanks,
Carl
Hi Carl!
Thanks for reaching out.
A CROSS JOIN
produces a cartesian product between the two tables, returning all possible combinations of all rows. It has no ON
clause because you're just joining everything to everything.
A FULL OUTER JOIN
is a combination of a LEFT OUTER
and RIGHT OUTER JOIN
. It returns all rows in both tables that match the query's WHERE
clause, and in cases where the ON
condition cannot be satisfied for those rows it puts NULL
values for the unpopulated fields.
Hope this helps.
Best,
Tsvetelin