Database Reference
In-Depth Information
Figure 10.4
A Natural Join or
Intersection.
some of the elements of each set appear in both sets. With respect to a rela-
tional database, until we create some kind of relationship between the two
sets, they are still unrelated.
In Figure 10.4, we can see the same two sets but now showing the inter-
section of those two sets. The intersection of Sets A and B would be the
equivalent of an inner join. An inner join contains only those elements
found in both sets.
Figure 10.5 shows all elements in Set A that are also in Set B (the inter-
section) plus all those elements in Set A that are not in Set B. This the
equivalent of a left outer join. As you can see, the picture contains the left
set outside the intersection area, plus only the parts of the right set that
match elements in the left set. “Why not just use Set A?” you ask. The
answer will be very clear when you begin using actual tables. Imagine these
examples as containing only one column each of two tables. Once matched,
you can find the values of all the other columns. For example, if Set A is a
table of cats and Set B is a table of dogs, you could use a left outer join to
list all the names of dogs (Set A) along with all the names of cats with the
same color fur as each dog (intersection, matching on fur color, of Set B).
You could not get this kind of list from Set A alone.
Figure 10.5
A Left Outer Join.
 
Search WWH ::




Custom Search