“If it was so, it might be; and if it were so, it would be; but as it isn’t, it ain’t. That’s logic.”—Tweedledee, in Lewis Carroll:

Through the Looking-Glass and What Alice Found There(1871)

As noted in Chapter 7, the relational calculus is an alternative to, and is expressively equivalent to, the relational algebra. It’s based on predicate calculus (also known as predicate logic); in fact, it can be seen as a version of predicate calculus that’s tailored for dealing with relations specifically. And a knowledge of the relational model can’t truly be said to be complete if it fails to include at least a basic understanding of the calculus; hence this appendix, which presents a brief tutorial on the subject.

The plan of the appendix is as follows. Following these introductory remarks, I’ll show a fairly lengthy series of simple examples, involving both queries and constraints, in order to give some idea of what calculus expressions look like “in action” (as it were); then I’ll give a simple grammar for such expressions. Do please note, however, that I’m not trying to describe any commercially available language in this appendix; nor will what I do describe be anything close to industrial strength. Instead, I’ll just show, and use, a somewhat hypothetical syntax that should be sufficient for illustrative purposes.

Now, a fundamental feature of the calculus is the *range variable*. Briefly, a range variable is a variable that “ranges over” some specified ...

Start Free Trial

No credit card required