relational-algebra

Definition

Natural Join (Relational Algebra)

The natural join combines two relations via common attributes (same names and domains) by combining only tuples with the same values for common attributes.

Given two relations and , the natural join can be expressed using projection, selection and the Cartesian Product:

Example

Given two relations and :

Students Relation:

StudentIDNameMajor
S101AlicePhysics
S102BobCS
S103CharlieBiology

Enrolments Relation:

StudentIDCourseIDGrade
S101C22A
S102C15B
S102C22A
S104C15C

There’s only one common attribute, namely StudentID. Therefore, the join condition is:

Thus, the resulting relation is:

StudentIDNameMajorCourseIDGrade
S101AlicePhysicsC22A
S102BobCSC15B
S102BobCSC22A