The join operation, denoted by , combines two relations R and Q to form a new relation S . If the attributes of R are referred to as and those of Q as then S has the m+n attributes . Tuples s of S are formed by concatenating a tuple with a tuple , denoted as . Usually there is a join condition C that has to be fulfilled by the tuples r and q that are concatenated to form an s. In total, the notation for the join looks like this:
The most frequently used condition is that an r has to hold the same value in a certain attribute, say Ai, as a q in an attribute, say Bj, if they are to be concatenated to form an s. This join condition is denoted as R.Ai = Q.Bj , and R.Ai and Q.Bj are said to be the join attributes .Put differently: the join is a subset of the cartesian product . The cartesian product of R and Q concatenates each tuple of R with every tuple of Q. This results in a new relation with tuples, with |R| and |Q| being the cardinalities of R and Q respectively. The result of the join can then be retrieved from by selection over the join condition C. Thus
(4) |
A typical query would be to find staff-student pairs who started in the department at the same time. These can be found by a join
using the join condition Figure 3.2 shows the result.