← Lectures·L4

Relational Algebra and SQL Queries

Prof. Dr. David B. Blumenthal · 7 concepts · 10 questions

Concept 1 / 7

Relational Algebra: Purpose and Structure

Relational algebra is a formal query language whose operands are relations and whose operators produce new relations. It serves two roles: it is the theoretical foundation for how DBMSs process queries, and many of its ideas are directly incorporated into SQL.


Evaluating an expression yields two things:

  • Result schema — determined by the schemas of the input relations and the operators applied
  • Result instance — the actual set of tuples obtained by running the operations

The complete set {σ, π, ∪, ρ, −, ×} is sufficient to express every other operator; joins, intersection, and renaming can all be derived from these six primitives.


CategoryOperators
Set operators (union-compatible)∪, ∩, −
Cartesian product×
Unary relation operatorsσ (select), π (project), ρ (rename)
Inner joinsNatural ⋈, Equi ⋈=, Theta ⋈_θ
Outer joinsLeft ⟕, Right ⟖, Full ⟗