Multiple outer joins semantics
They are processed in top-to-bottom order, with the joins all associating to the "whole" of the prior FROM clause.
All things being equal:
- tab1 is the mandatory partner for the OUTER JOIN with the optional partner tab2
- the above is the mandatory partner for the OUTER JOIN with the optional partner tab4
- the above and tab4 are both mandatory partners in the INNER JOIN
- the above is the mandatory partner for the OUTER JOIN with the optional partner tab5
However, the problem with this query
SELECT *FROM table1 tab1 LEFT OUTER JOIN table2 tab2 ON tab1.fg = tab2.fgLEFT OUTER JOIN table4 tab4 ON tab1.ss = tab4.ssINNER JOIN table3 tab3 ON tab4.xya = tab3.xyaLEFT OUTER JOIN table5 tab5 ON tab4.kk = tab5.kk
Is that the INNER JOIN with table3 uses a condition that REQUIRES tab4 to get involved, making it virtually a mandatory link to retain records from the left part, so in total tab1/tab4/tab3 have to successfully join, with tab2 and tab5 optional.