Natural join with more than one common attribute in two tables

Hiep picture Hiep · Oct 14, 2014 · Viewed 18.9k times · Source

I can understand how natural join works when the two tables have only one common attribute. What if they have two ones? Table 1 have 3 attributes: A, B, C Table 2 has 3 attribute: A, B, D

First two rows in table 1:

1 2 3
4 5 6

First two rows in table 2:

1 3 4
8 5 8

What is the result of a natural join between the two tables?

Answer

Dan picture Dan · Oct 14, 2014

In the case of your two records above, nothing will be matched. It will look for the case when A & B in the left table match A & B in the right table.