We can simplify the sequence of CARTESIAN PRODUCT followed by SELECT into a single operation JOIN.

The general form of a join operation on two relations and is:

Where and can be any relations that result from general relational algebra expressions.

Examples:

  • Suppose we want to retrieve the name of the manager of each department. The join condition is MGRSSN=SSN or DEPT.MGRSSN = EMPLOYEE.SSN.

Theta JOIN

Theta JOIN (Relational Operation)

The general case of the JOIN operation is called a Theta-join:

The join condition is called theta. Theta can be any general boolean expression on the attributes of and , e.g.:

Link to original

EQUIJOIN

EQUIJOIN (Relational Operation)

The most common use of join involves join conditions with equality comparisons only, in this case, it is called an EQUIJOIN.

In the result of an EQUIJOIN, we have one or more pairs of attributes that have identical values in the tuple.

Link to original

NATURAL JOIN

NATURAL JOIN (Relational Operation)

The NATURAL JOIN operation, denoted by , was created to get rid of the second attribute in an EQUIJOIN condition.

To apply aw natural join on the DNUMBER attributes of DEPARTMENT and DEPT_LOCATIONS, it is sufficient to write:

Link to original