UP TO 30 % OFF for licences and upgrades!

A common type of operation that usually cannot be defined in the relational algebra is the recursive closure. This operation is used exclusively in recursive relationships.

This relationship is described by a foreign key that relates each tuple in a table similar to another tuple in a related table. An example of a recursive operation is to retrieve all the employees of another employee and at all levels, ie all employees and the ones ‘directly supervised by that employee, and’ ‘directly supervised by e’, all employees and ‘ ” directly supervised by him’, and so on.

Although it is simple to specify, in the relational algebra, all supervised employees by a specific level, it is difficult to specify all supervised employees at all levels. For example, to specify the codes of all employees and ‘directly supervised employees’ ⎯ ⎯ at level one by whose name is’ James Borg’, it is possible to apply the following operations:

BORG_NSS ← πNSS  (σ PNAME = ‘James’ AND SNAME = ‘Borg’ (EMPLOYEE))



To retrieve all employees supervised by Borg at level two, ie all employees and ‘ employees supervised by the first employee’ and that is directly supervised by Borg, you can apply another JOIN to the result of the first query:


For all employees supervised at levels one and two of ‘James Borg’, you can apply the UNION operation as follows:


Although it is possible to recover the employees supervised at each level, you cannot specify a query such as “retrieve all employees supervised by ‘James Borg’ at all levels” if not known the maximum number of levels.


Recursive closing operations


Relational calculus

The Relational Calculus (RC) is a formal query language which, via a declarative expression, can specify a retrieval request. There is no restriction on the way to evaluate a request.

A calculation expression allows the description of the desired query without specifying the procedures for obtaining this information, that is, non-procedural. However, it should be able to formally describe the desired information with accuracy.

There are two types: Relational Calculus of Tuples (RCT) and Domain Relational Calculus (DRC), both simple first-order logical subsets.

In Relational Calculus there are variables, constants, logical operators, comparison and quantifiers. The calculation expressions are called formulas. A tuple of answers is essentially an assignment of constants to variables that take the formula to a real state.

In RCT, the variables are defined on (i.e., bound to) tuples. On the other hand, in DRC, variables are defined on the domain of the elements (ie on the field values).

All query expressions described in RC have equivalent in RA.

The relational calculus of tuples, one of the most used, is based on the specification of a number of tuple variables. Each tuple variable may have as its value any tuple of the specified ratio.


A query on RCT is specified as follows:

{Variable tuple | predicate}

The result of such a query is the set of all tuples variables for which the predicate is indicated as true.

All tuple variables discussed so far are considered free variables, since they appear not quantified. However, in addition to the default settings, (universal (∀) or existential (∃)) quantifiers may appear in formulas. In this case, the variables which follow are called variable threshold.

Finally, an expression RCT can generate a multitude of relationships. For the expression {t | NOT (R (t))} there may be a multitude of tuples that are not R, so that it is non-secure. Most of these tuples contain values ​​that are not in the database, therefore, are not desirable as a result.


You might also like…

Deep Data: Is it possible when you’re non-profit?

Evan Liebovitch talks about deep data and how to document the needs of a non-profit while using Scri...

Deep Data: Creating Powerful Large Systems

Creating powerful large systems to support business processes in a cost-effective and accessible man...

How to recognize business models and processes from Deep Data Perspective

Listen to the podcast and learn how to recognize business models and processes from Deep Data Perspe...

Comment this post

Get new posts, resources, offers and more each week.