Relational Algebra

Context: FIT2094_MOC Β· a procedural, relationally complete query language over relations Β· results are relations (closure) Β· what a DBMS translates SQL into

Quick Revision

  • 🎯 Objective: a procedural, relationally complete query language over relations βž” states how.
  • πŸ“¦ Core Components: unary Ο€ βž” binary set ops / joins / product / division.
  • ⚑ Key Constraint: closure β€” every result is a relation, so operators compose; no NULLs in pure form.

πŸ“ Core

1. The Language

  • Procedural βž” specifies how (an order of operations).
  • Relationally complete βž” expresses any query relational calculus can.
  • Operators βž” (unary); (binary).

2. Closure

  • Result is a relation βž” queries compose (output feeds input).
  • Nested algebra βž” complex queries built from operators.

3. The DML Family

  • Relational calculus βž” non-procedural (yardstick for completeness).
  • SQL βž” declarative, transform-oriented.
  • Graphical βž” visual query-by-form.

βš™οΈ Core Implementation

πŸ”Ή SQL β†’ algebra

βš–οΈ Core Decision Matrix

LanguageProcedural?Role
relational calculusnocompleteness benchmark
relational algebrayesexecution/optimisation
SQLno (declarative)user queries
graphicalnovisual

When It Flips: algebra prescribes an operation order (good for the optimiser); calculus/SQL state only the result β€” the DBMS bridges them by compiling SQL to algebra. Relational join generalises FIT1058 relational composition to data.

πŸ“Š Exam Execution Trace

Applied Exercise

Problem: Translate SELECT project_manager FROM PRDETAIL WHERE project_code='25-5A' into algebra. Derivation Proof / Hand-Calculation Walkthrough:

Final Extracted Output: .

🧠 Active Recall