Download free books at BookBooN.com
An Introduction to Relational Database Theory
89
Relational Algebra – The Foundation
The current value of IS_CALLED shown in Figure 4.1 tells us that the extension of “Student StudentId is
called Name” is (currently) the set {Student S1 is called Anne, Student S2 is called Boris, Student S3 is
called Cindy, Student S4 is called Devinder, Student S5 is called Boris}, each element of which is an
instantiation of the predicate that happens to be true. From the given definition it follows that every other
instantiation of that predicate is false and therefore does not appear in its extension. The assumption that
the body of a relation consists of every tuple that satisfies the relation’s predicate is called the closed
world assumption. This assumption underpins the operators of the relational algebra. Under the open
world assumption, every tuple that’s in the relation does represent a true proposition but it is possible for
tuples that satisfy the predicate not to appear in the relation. It would not be possible to devise relational
operators based on that assumption, for unless every instantiation of the predicate were false it would be
an arbitrary choice as to which tuples, if any, are to be included.
4.3 Relational Operators and Logical Operators
The operators of the relational algebra are nearly all relational counterparts of the logical connectives AND,
OR, and NOT, and existential quantification. Each relational operator, when invoked, yields a relation,
which can be interpreted as the extension of some predicate. Because relations are used to represent
predicates, it makes sense for relational operators to be counterparts of logical operators. Example 4.1
illustrates the use of JOIN as the relational counterpart of the logical operator AND to give us the relation
representing the predicate
Student StudentId is called Name AND StudentId is enrolled on course CourseId.
where the predicates for IS_CALLED and IS_ENROLLED_ON are connected by AND.
We will meet other examples, enabling us to obtain relations representing predicates such as
x Student StudentId is enrolled on some course.
Here the predicate for IS_ENROLLED_ON is subject to existential quantification on CourseId.
x Student StudentId is enrolled on course CourseId AND StudentId is NOT called Devinder.
Here the predicate for IS_ENROLLED_ON is connected by AND to the negation of the monadic
predicate formed by substituting Devinder for Name in the predicate for IS_CALLED.
x Student StudentId is NOT enrolled on any course OR StudentId is called Boris.
Here the negation of the predicate resulting from existential quantification of the predicate for
IS_ENROLLED is connected by OR to the predicate formed by substituting Boris for Name in the
predicate for IS_CALLED.