# What are the practical uses for relational calculus?

In my Database Design course we are learning both Relational Algebra and Relational Calculus. I can see where Relational Algebra could be useful since it is closely tied to SQL.

Our professor said that Relational Calculus was used as an alternative to SQL in some RDMBS, most of which are not around any more. Is there still a practical use for Relational Calculus, or is much of this theoretical?

# Context

In order to provide more context, it is necessary to have an authoritative definition for both terms. So, here are some excerpts from the relevant paper entitled Relational Completeness of Data Base Sublanguages, which was writen by the originator of the relational model, Dr. E. F. Codd, and published in 1972:

Relational algebra. The primary purpose of this algebra is to provide a collection of operations on relations of all degrees (not necessarily binary) suitable for selecting data from a relational data base.

Relational calculus. Having defined a relational algebra, we now consider an applied predicate calculus which may also be used in the formulation of queries on any data base consisting of a finite collection of relations in simple normal form.

In this way, one can see that they serve the same purpose, since they are two different mathematical means to express a group of operations considered valid within the relational framework.

### Comparison of both approaches

In the same paper, Codd contrasts both methods in order to point out some important aspects in which each one stands out:

One advantage that might be claimed for the algebraic approach is its freedom from quantifiers. Howerver, the calculus appears to be superior to algebra in four respects.

1. Ease of augmentation
2. Scope for search optimization
3. Authorization capability
4. Closeness to Natural Language

So, these aspects should be taken into account by organizations that aim to build their own languages or database platforms.

# Practical value

I do not know if there are contemporary successfully commercial RDBMS that provide query languages purely based on relational calculus, but I deem that its practical worth lies in the fact that it offers a theoretically grounded alternative for vendors who plan to design and implement a new valid relational language, or extend an existing one without departing from proven and accepted practices. In this respect, it can be useful to think of relational calculus as a blueprint that such vendors can follow in order to produce a relational language.

Since the market is largely dominated by SQL platforms, millions of users around the world are already familiar with several of its particular dialects, and billions of dollars are invested in such platforms, it would be very interesting to determine whether creating new relational lenguages would be profitable, but if so, relational calculus could always play an important role.

Of course, such projects can be much more feasible in the academic field, so there is more practical value regarding this tool.

• Actually relational completeness was defined in terms of the tuple calculus, not the algebra. At the time, in the original paper, the tuple calculus had OR, implemented by UNION, but did not offer the full power of UNION, so it was actually weaker than the algebra. Also originally it did not handle empty tables! PS SQL itself is more or less a hybrid of the algebra and the domain calculus, where T.C acts as a column name of the implicit cross join of a FROM. – philipxy Dec 27 '15 at 1:06

The relational algebra and the relational calculus are essentially logically equivalent: for any algebraic expression, there is an equivalent expression in the calculus, and vice versa.

Basically they are two tools/methods that produce effectively the same output. Learning one might give insight into the other, and the additional insight is the real value to learning both.