# Is relational algebra a procedural, imperative, and/or declarative language?

In Database System Concepts 6ed,

6.2 The Tuple Relational Calculus

When we write a relational-algebra expression, we provide a sequence of procedures that generates the answer to our query.

The tuple relational calculus, by contrast, is a nonprocedural query language. It describes the desired information without giving a speciﬁc procedure for obtaining that information. A query in the tuple relational calculus is expressed as: {t | P(t)}. That is, it is the set of all tuples t such that predicate P is true for t.

Does the above mean that relational algebra is a procedural language?

Is relational algebra a declarative language?

Is the tuple relational calculus a declarative language?

Is the tuple relational calculus more declarative than relational algebra is?

Is a procedural language an imperative language? (This is always what I heard, but I also heard that SQL is a declarative language (so is relational algebra) so is not imperative.)

What is the correct or most reasonable or most accepted definition of procedural languages, imperative languages, and declarative languages?

Thanks.

The terminology used in the database area calls the relational algebra “procedural” to contrast it with the languages based on “calculus”, since an algebraic expression describes an ordered set of steps to find the result: simply execute the operations in the correct order to produce the result.

In contrast, in an expression of a calculus based language, the result is described through a property that holds on it, without specifying which operations should be applied to find it, neither the order in which they should be applied. So it “declares” the properties of the result, not a “procedure” to obtain it.

This terminology has no particular relations with other terminologies in the field of programming languages (like imperative, functional, applicative, etc.)

• Thanks. Could you try to classify relational algebra and relational calculus by the paradigms in programming languages?
– Tim
Nov 24, 2019 at 11:42
• Both of them do not have the concept of mutable state or of function, so they cannot be classified along the axis “imperative/functional”. Maybe calculus based languages could be said “logic”, given they vague resemblance to Prolog. But I don’t think this kind of classification can help in understanding better their characteristics. Nov 24, 2019 at 12:59