Relational Algebra


[Previous] [Table of Contents] [Next]

Relational Algebra

Relational Algebra is a set of basic operations used to manipulate the data in relational model. These operations can be classified in two categories:

1. Basic Set Operations

  • Union
  • Intersection
  • Set Difference
  • Cartesian Product

2. Relational Operations

  • Select
  • Project
  • Join
  • Division

Union

If R1 and R2 are two union compatible relations then R3 = R1 ∪ R2 is the relation containing tuples that are either in R1 or in R2 or in both.

Picture1

Intersection

If R1 and R2 are two union compatible relations, then the result of R3 = R1 ∩R2 is the relation that includes all tuples that are in both the relations

Picture2

Set Difference

If R1 and R2 are two union compatible relations then result of  R3 =R1– R2 is the relation that includes only those tuples that are in R1 but not in R2.

Picture3

Cartesian Product

If R1 and R2 are two functions or relations, then the result of R3 = R1 × R2 is the combination of tuples that are in R1 and R2.

Degree (R3) =Degree of (R1) + Degree (R2).

Picture4