I read this article about the working of Full Joins.
The article says that a Full Join
, which combines the results of Left Join
and Right Join
, "retains duplicate rows". Therefore, in order to simulate a FULL JOIN, we use UNION ALL
instead of UNION
.
But, when I perform a FULL JOIN
on two tables in Oracle, I do not find duplicates at all. (I believe, Oracle internally uses the 'UNION ALL' operation on left and right joins to perform a FULL JOIN.) The left join and right join contain some common rows, but when I run a full join, those common rows don't appear twice.
Results of Left Join :
SELECT * FROM ORDERS LEFT JOIN CUSTOMER ON ORDERS.CUSTOMERID = CUSTOMER.CUSTOMER_ID;
Results of Right Join :
SELECT * FROM ORDERS RIGHT JOIN CUSTOMER ON ORDERS.CUSTOMERID = CUSTOMER.CUSTOMER_ID;
Results of Full Join :
SELECT * FROM CUSTOMER FULL OUTER JOIN ORDERS ON CUSTOMER.CUSTOMER_ID = ORDERS.CUSTOMERID;
As you can see from the results of FULL JOIN
, it "Does not contain duplicate rows" , even though left join and right join have some common rows.
So, why is it believed that a full join contains duplicate rows ? Am I missing something ?