ON THE RELATIONAL ALGEBRA VS. CALCULUS
with Hugh Darwen and C. J. Date

 

 

 

From: EM

To: Editor

Date: 2 Dec 2004

 

In THE THIRD MANIFESTO, Chris Date gives two versions of Tutorial D, one based on relational algebra, the other based on relational calculus. What precisely is the difference between an algebra and a calculus and when might you favour one over the other?

 

 

From: Hugh Darwen

To: Editor

 

Why do so many people attribute THE THIRD MANIFESTO to Chris alone?  What have I done wrong? (sob)  Do I have to blame the publishers for refusing to give our names in alphabetical order?

 

As a matter of fact, though, the calculus-style notation described in Appendix A was entirely Chris's work.  That said, I think he would agree that the Tutorial D algebra is mostly mine, and I certainly claim a great deal of influence on the choice of operators.  Chris wasn't so interested in the algebra before he and I started collaborating towards the end of the 1980s.

 

Anyway, your correspondent might be interested to hear that we are excluding Appendix A from our forthcoming third edition.  On closer scrutiny we found a number of problems with it that we didn't have enough time and inclination to address.

 

Chris will probably give a more helpful response to Eric M.'s questions, but here's my ha'penny-worth anyway.

 

EM. asks two questions. 

 

The first is one I have asked many times myself, of several respected gurus.  I have never received a satisfactory answer.  What I say in the rest of this paragraph is merely an attempt to declare my own understanding and lack thereof.  It carries no authority.  I think I know what an algebra is. It's a collection of operators, closed over the elements of some given domain. I rather suspect that the term differs from "calculus" in that, unlike "calculus", it does have a reasonably precise definition.  Note that conceptually at least we can have an algebra in the absence of any notation for writing expressions in it. We would of course need some notation in order to be able to use it or discuss it with other people, but any number of different notations can be used for the same algebra.  I find it difficult to think about the term "calculus" in a similar way, mainly because I don't know what it means, in general.

 

As for EM's second question, I'm afraid my answer is purely personal and therefore perhaps even less helpful: I always prefer a notation akin to Tutorial D as defined in Chapter 5.  It might be the computer programmer in me that gives rise this preference.  The Chapter 5 notation allows me easily to break a solution down into a sequence of simple steps.  But it is also the case that I have never seen the so-called calculus style fully developed in a complete, industrial-strength database language.  For that reason, I feel I have never been able to evaluate it properly.

 

One thing we are all agreed on, though, (I hope) is that the difference in question is merely a psychological one, not a logical one.

 

 

C. J. Date Responds: The following paragraphs are taken from my book THE DATABASE RELATIONAL MODEL: A RETROSPECTIVE REVIEW AND ANALYSIS

 

Ø       According to Chambers Twentieth Century Dictionary, an algebra is "any of a number of systems using symbols and involving reasoning about relationships and operations."  More specifically, an algebra consists of a set of objects and a set of operators that together satisfy certain axioms or laws (such as closure, commutativity, associativity, and so on).  The word "algebra" itself ultimately derives from Arabic al-jebr, meaning a resetting (of something broken) or a combination.

 

Ø       Relational calculus is an applied form of a fundamental branch of logic called predicate calculus.  In general, the term "calculus" signifies merely a system of computation (the Latin word calculus means a pebble, perhaps used in counting or some other form of reckoning).  Thus, relational calculus can be thought of as a system for computing with relations. 

 

Relational algebra and relational calculus are logically equivalent; in some respects, therefore, the choice between them comes down to nothing more than a matter of personal taste or style.  It might be claimed, very loosely, that programmers prefer the algebra while end-users prefer the calculus.  Some aspects of reasoning do seem to be more readily framed in terms of the calculus.  Codd himself, in his "relational completeness" paper, gave his own arguments for regarding the calculus as superior (or at least more user-friendly), and he even claimed elsewhere that the calculus was at a higher level of abstraction than the algebra.  In the book mentioned above, however, I give my own reasons for thinking his arguments don't really stand up, even though I do tend to prefer the calculus myself. 

 

I'll say one more thing:  The algebra, consisting as it does of explicit operators, is more clearly implementable than the calculus (albeit not necessarily efficiently so!); the calculus looks a little more like natural language, and its implementability is thus not so immediately obvious.  In fact, by showing that any expression of the calculus could be mapped into a semantically equivalent expression of the algebra, Codd provided a basis for implementing the calculus. 

 

Exercise for the reader:  If a database language can be based on either the algebra or the calculus, which do you think SQL is based on?

 

 

Posted 2/18/05