Relational Algebra

Learned in CS348.

What is the difference between Relational Algebra and Relational Calculus?

Relational Algebra:

  • Procedural query language
  • Specifies step-by-step operations like select, project, union, etc
  • More suitable for programmers
  • Often used in DBMS implementation

Relational Calculus:

  • Declarative query language
  • Specifies what information is needed, not how to get it
  • Two forms: Tuple Relational Calculus (TRC) and Domain Relational Calculus (DRC)
  • More theoretical and intuitive for mathematicians

Relational Algebra is procedural query language. Relational Calculus is a non-procedural or declarative query language. Relational Algebra targets how to obtain the result, whereas relational Calculus targets what result to obtain. Source

  • So if I understand correctly you need both, RC to store into the database, and RA to query the database…? I’m not convinced that is the right explanation
  • Like there is RC query? What is that about?

RA Queries use operations such as SELECT, PROJECT, UNION, INTERSECT, etc. Whereas RC Queries is like INSERT, DELETE. (I think? NO, I don’t understand but I don’t have time to understand)

So from the W18 Final: What is the main difference between relational calculus and relational algebra?

  • Solution: Relational calculus is a declarative language that requires the user to specify the predicates that need to be satisfied by all the tuples in the result relation. Relational algebra, on the other hand, is procedural where the user specifies how to execute the query by means of relational algebraic operators.