Databases Reference
In-Depth Information
This expression denotes a relation containing all tuples of the form ( s , n , t ) such that a tuple of the
form ( s , n , t , c ) currently appears in relvar S for some CITY value c . In other words, the result
contains all and only those tuples that correspond to currently true instantiations of the following
predicate:
There exists some city CITY such that supplier SNO is under contract, is named SNAME,
has status STATUS, and is located in city CITY.
This predicate thus represents the meaning of the expression—the relational expression,
that is—S{SNO,SNAME,STATUS}. Observe that it has just three parameters and the
corresponding relation has just three attributes; CITY isn't a parameter to that predicate but what
logicians call a “bound variable” instead, owing to the fact that it's “quantified” by the phrase
There exists some city CITY such that . Note: A possibly clearer way of making the same point
(i.e., that the predicate has three parameters, not four) is to observe that the predicate in question
is effectively equivalent to this one:
Supplier SNO is under contract, is named SNAME, has status STATUS, and is located
somewhere [in other words, in some city, but we don't know which].
Remarks analogous to the foregoing apply to every possible relational expression. To be
specific: Every relational expression rx always has an associated meaning, or predicate;
moreover, the predicate for rx can always be determined from the predicates for the relvars
involved in that expression, in accordance with the semantics of the relational operations
involved in that expression. 17
Aside: To repeat, the projection of suppliers on all attributes but CITY can be expressed in
Tutorial D as follows: S {SNO,SNAME,STATUS}. For convenience, however, Tutorial
D also allows projections to be expressed in terms of the attributes to be removed instead of
the ones to be kept. Thus, for example, the expression S {ALL BUT CITY} is equivalent
to the one just shown. An analogous remark applies, where it makes sense, to all of the
operators in Tutorial D . End of aside .
Now, relvar predicates as I've described them so far are quite informal; in fact, they're
essentially nothing more than a representation in natural language of the fact that the relvar in
question has certain attributes (equivalently, is of a certain type). But we could use a somewhat
more formal style if we wanted to. For example, given that the suppliers relvar S has attributes
SNO, SNAME, STATUS, and CITY, and given also that {SNO} is the sole key for that relvar,
we might say the corresponding predicate looks something like this:
17 Thus, we can extend The Closed World Assumption as follows: A proposition p is considered to be true at a given time if it
corresponds to a tuple t and that tuple t either (a) appears in some database relvar at that time (as already explained) or
(b) appears in some relation that can be derived from the relations that are the values of those database relvars at that time. In
other words (loosely): Everything stated or implied by the database is true; everything else is false.
Search WWH ::




Custom Search