In the book Database System Concepts 6th Edition, Chapter 2 (Relational Algebra), it states that there are three formal query languages, the relational algebra, the tuple relational calculus and the domain relational calculus, which are declarative query languages based on mathematical logic. But then, on another page it states that relational algebra is procedural, whereas the tuple relational calculus and domain relational calculus are non-procedural. Which of these is the right statement? Could you provide simple examples illustrating the difference?

1 Answer 1


The writing is poor. "Declarative" is informal & they use it it in two ways. The general meaning is, "describe a result (not a process)". But many descriptions of results have an obvious interpretation as a process. So those "describe a result & a process" whether or not they were intended to. The first says "the notations can be used to describe results without intending any particular process". The second says "the algebra has a procedural interpretation & the calculi don't".

But the latter statement is a myth. It is parroted received [pseudo-]wisdom. The algebra has an obvious procedural interpretation--we call operators on arguments. But the calculi do too. The calculi don't have an obvious procedural interpretation in terms of standard relational operators.

But the idea is that the calculi aren't used to request such procedures.

The calculi have a straightforward procedural interpretation in terms of standard relational operators where you mechanically convert them to "prenex normal form" then mechanically convert them to standard relational algebra. (Codd's reduction algorithm.) Also, they have an obvious procedural interpretation (not in terms of relational algebra) in terms of trying every possible tuple for membership in the result. (Like standard Tarskian semantics for predicate calculus.) Also, they have an obvious procedural interpretation in terms of an algebra with two simple but impractical operators added--a generalization of UNION (corresponding to OR) & an operator returning the tuples not in a relation (corresponding to NOT). (Already NATURAL JOIN corresponds to AND & PROJECTing out corresponds to EXISTS.) (Like Tarskian cylindric-algebra semantics for predicate calculus.)

Difference between Relational Algebra and Relational calculus
Procedural and non-procedural query language difference


This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .