OUTER JOIN
Outer join is an extended form of the regular or inner join
operation. It differs from the inner join in that tuples in one
relation having no counterpart in the other appear in, the
result with nulls in the other attribute positions, instead of
simply being ignored as they normally are. It is not a primitive
operation; for example, the following expression could be used
to construct the outer join of suppliers and shipments on
supplier numbers.
In fig. 3, the top portion shows some sample data values for
relation variables S and SP, the middle portion shows the
regular inner join. and the bottom portion shows the
corresponding outer join. As the figure indicates, the inner
join "loses information" for suppliers who supply no parts
(supplier S5, in the example), whereas the outer join
“preserves” such information; indeed, exactly that distinction
is the whole point of outer join.
Figure 3 – Inner vs. outer join (example)
<<
К содержанию
>> |