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.
| Category | Operators |
|---|---|
| Set operators (union-compatible) | ∪, ∩, − |
| Cartesian product | × |
| Unary relation operators | σ (select), π (project), ρ (rename) |
| Inner joins | Natural ⋈, Equi ⋈=, Theta ⋈_θ |
| Outer joins | Left ⟕, Right ⟖, Full ⟗ |