A common type of operations 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.

By ,

May 5, 2016


You might also like…

“We developed RISK4ALL, a SaaS platform that allows implementing GRC in an organization with total security and privacy.” (RISK4ALL)

Come and discover the success case of the Risk4all, software, a multilingual and multi-company SaaS...

Security in web applications

In this article, you will learn about web application security and the options within Scriptcase th...

“We have developed the Connected Citizen Card, which assists public administrators in decision-making and policy creation.”(Assist Soluções em TI)

Check below how Assist Soluções em TI used Scriptcase to modernize and streamline the development...

You might also like…

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

We will use the information you provide to update you about our Newsletter and Special Offers. You can unsubscribe any time you want by clinck in a link in the footer of any email you receive from us, or by contacting us at sales@scriptcase.net. Learn more about our Privacy Police.