1. Gyanastra
  2. Database Systems
  3. Relational Algebra
  4. Relational Algebra and Relational Calculus as Formal Query Languages
Free lesson, no account needed 4 min read 8 practice questions after it
Asked in past papers7 times
  • GATE CSE2006200219961994
  • UGC NET202220132009

Database Systems · Relational Algebra

Relational Algebra and Relational Calculus as Formal Query Languages

Overview

The relational model is a formal, theoretical platform derived from set theory. Alongside it, IBM researchers proposed two formal query languages — relational algebra and relational calculus — and their practical implementation is SQL, which runs on top of a relational DBMS.

Key concepts

  • Relational model: a theoretical/formal platform derived from set theory; set theory gives relations, and relations give the relational model.
  • Relational algebra and relational calculus: formal query languages proposed together with the relational database model by researchers at IBM. A database in the relational model can be queried with them.
  • RDBMS (relational database management system): popular RDBMSs use the relational model and provide an implementation of relational algebra and relational calculus.
  • SQL: the practical implementation of relational algebra and relational calculus.
  • Formal vs informal terminology: many relational terms are new; informal equivalent terms may be used in explanations to make them easier to remember, but strictly speaking only the formal relational terms should be used in the relational model.
    Informal terms are only for easy understanding and recall — the exam expects the formal terms, and students must be able to map informal terms to formal ones.
  • Relation: the first formal term introduced in the relational model.
Figure. Relational algebra and relational calculus

How it works

  1. Design the database using the ER model.
  2. Convert the ER model into the relational model.
  3. Install any relational database management software.
  4. Use SQL, an implementation of relational algebra and relational calculus, to query the database through the relational DBMS.
  5. SQL runs on top of the RDBMS: a query given to the RDBMS is converted into relational algebra / relational calculus, and the converted query finally acts on the relational database model itself.

Comparison

ItemRole
Relational algebra and relational calculusFormal query languages proposed with the relational database model by IBM researchers
SQLPractical implementation of relational algebra and relational calculus used in RDBMS
RDBMSRuns SQL on top of it; converts SQL queries into relational algebra / relational calculus and applies them to the relational database model

Revision summary

  • The relational model is formal/theoretical and is derived from set theory.
  • Relational algebra and relational calculus are the formal query languages for the relational model.
  • SQL is the practical implementation of relational algebra and relational calculus.
  • Practical design flow: ER model → relational model → RDBMS → SQL queries.
  • SQL runs on top of the RDBMS; the RDBMS converts a query into relational algebra/relational calculus before acting on the relational database.
  • Informal terms are only for explanation and recall; the relational model strictly uses formal terminology.
  • In the exam, use the formal terms and be able to map informal terms to formal ones.
  • The first term in the relational model is relation.

Previous-year exam insights

  • Relational algebra is procedural (operational): it specifies a sequence of operations to compute the result.
    Relational calculus is non-procedural (declarative): it only states what the result must satisfy, not how to compute it.
    Asked inUGC NET 2013UGC NET 2009
  • Relational calculus has two forms: tuple relational calculus (variables range over tuples) and domain relational calculus (variables range over attribute values/domains).
    SQL's query language is based on relational algebra and tuple relational calculus.
    Asked inUGC NET 2013UGC NET 2009
  • Relational algebra and relational calculus are equivalent in expressive power: every algebra expression has an equivalent safe calculus expression and vice versa (relational completeness).
    Asked inUGC NET 2009
  • Core relational algebra operators: selection (σ), projection (π), union (∪), set difference (−), Cartesian product (×), rename (ρ); derived operators: intersection (∩), natural join (⋈), division (÷), theta/outer joins.
    Asked inUGC NET 2013
  • A natural join equates all attributes with the same name in the two relations and keeps only one copy of each common attribute; if there are no common attributes it degenerates to a Cartesian product.
    Asked inUGC NET 2013
  • The closure of a set of attributes X under a set of functional dependencies F (X+) is the set of all attributes functionally determined by X; it is computed with Armstrong's axioms and is used to test superkeys and lossless decomposition.
    Asked inUGC NET 2013
Pages 1–2 of 2