Tuple Level | Schema Level
Written Syntax: RelationA ⋈ RelationB
Arcade Syntax: RelationA Join RelationB
Operation Definition
This binary operation results are a little more complex than the others. First it makes a list L of which attributes have the same type and name between both relations. It then iterates through the cross join of A and B, selecting only the tuples where the component value is similar between the two relations for all attributes in L. It then projects out L, so that there is no longer a pair of matching attributes in the resulting relation. Since relations are sets, the result only has unique tuple. This operation requires:
- 1) A – a relation. It is desirable to have at least one similar attribute header to B.
- 2) B – a relation. It is desirable to have at least one similar attribute header to A.
Usefulness:
This is one of the most useful operators, though it is simply a unique combination of other operators. Similar to Cross Join, a Natural Join is useful for when you need to search through pair’s/combinations of tuples from different relationships for attributes values that are spread across different relations. The example below illustrates this usefulness more clearly. For reference, Natural Join is actually equivalent to: Project[All A – Bi] (Select[All Ai = Bi](A CrossJoin B) )
Example:
Foo (Orginal)
A |
B |
1 |
2 |
3 |
4 |
Baz (Orginal)
A |
B |
C |
1 |
2 |
3 |
5 |
6 |
7 |