If DBMS does not support FULL JOIN (MySQL), it can be obtained via union of left and right outer joins. So our formula takes the form
A UNIONJOIN B :=
((A LEFTJOIN B)
UNION
(A RIGHTJOIN B))
EXCEPT
(A INNERJOIN B)
To demonstrate the case where this type of join could be useful, let's consider the following task.
Find out the makers which produce printers but not PCs or produce PCs but not printers.
Having the ability to use UNION JOIN, we could solve the task as follows:
SELECT * FROM
(SELECTDISTINCT maker FROM Product WHERE type='pc') m_pc
UNIONJOIN
(SELECTDISTINCT maker FROM Product WHERE type='printer') m_printer
ON m_pc.maker = m_printer.maker;
Let's use the formula. Full join of PC makers with printer makers gives us those who produce only one type of product as well as those who produce both types - PCs and printers.
Console
Execute
SELECT * FROM
(SELECTDISTINCT maker FROM Product WHERE type='pc') m_pc
FULLJOIN
(SELECTDISTINCT maker FROM Product WHERE type='printer') m_printer
In so doing I remove from the solution superfluous DISTINCT keywords because EXCEPT will exclude duplicate rows. This is a single useful lesson here, as substraction operation (EXCEPT) can be replaced by a simple predicate:
WHERE m_pc.maker ISNULLOR m_printer.maker ISNULL
or even
m_pc.maker + m_printer.maker ISNULL
in view of the fact that concatenation with NULL gives NULL.
Console
Execute
SELECT * FROM
(SELECTDISTINCT maker FROM Product WHERE type='pc') m_pc
FULLJOIN
(SELECTDISTINCT maker FROM Product WHERE type='printer') m_printer
It is needless to say that this is only one of possible methods to solve the task. The purpose of approach presented was to demonstrate a possible replacement of the deprecated join type.