Next: Role of the Join
Up: Join Processing
Previous: Join Processing
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) |
As an example for a join, consider the two relations Staff and
Student of figure 3.1. Imagine that
these relations respectively hold members of staff and students of a
certain university department. Staff members are described by their
name, office, start and end dates of the period they worked in the
department. Similarly, students have a name, a workroom that is
assigned to them, a start and an end date. For simplicity, we assume
that names are unique.
Figure:
Example relations holding staff members and students.
![\begin{figure}
\begin{center}
\begin{small}
\mbox{
\subfigure[{\bf \tt Staff}]{...
...r}}}\end{small}\end{center}\index{{\em Staff}}
\index{{\em Student}}\end{figure}](img34.gif) |
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.
Figure:
Result of the join
.
 |
Next: Role of the Join
Up: Join Processing
Previous: Join Processing
Thomas Zurek