Databases Reference
In-Depth Information
relvars LS and NLS are the only relvars in another database DB2 , and DB1 and DB2 are
information equivalent. But first things first.
Now, as you can see from the definitions, {SNO} is a key (in fact, the sole key) for each of
the three relvars; also, {SNO} is a foreign key in each of relvars LS and NLS, referencing the
key {SNO} of relvar S, though I haven't bothered to declare those foreign keys explicitly. 1
Note: As mentioned a couple of times in previous chapters, in practice we would probably drop
attribute CITY from relvar LS, precisely because its value is constant (it's always London);
however, I won't do that here, in order to keep the example simple. Of course, if we did drop
that attribute, then LS would no longer be just a restriction as such of S anyway, and in this
chapter I want to limit my attention to restriction specifically.
Sample values are shown in Fig. 4.1.
S LS
┌─────┬───────┬────────┬────────┐ ┌─────┬───────┬────────┬────────┐
│ SNO │ SNAME │ STATUS │ CITY │ │ SNO │ SNAME │ STATUS │ CITY │
├═════┼───────┼────────┼────────┤ ├═════┼───────┼────────┼────────┤
│ S1 │ Smith │ 20 │ London │ │ S1 │ Smith │ 20 │ London │
│ S2 │ Jones │ 10 │ Paris │ │ S4 │ Clark │ 20 │ London │
│ S3 │ Blake │ 30 │ Paris │ └─────┴───────┴────────┴────────┘
│ S4 │ Clark │ 20 │ London │ NLS
│ S5 │ Adams │ 30 │ Athens │ ┌─────┬───────┬────────┬────────┐
└─────┴───────┴────────┴────────┘ │ SNO │ SNAME │ STATUS │ CITY │
├═════┼───────┼────────┼────────┤
│ S2 │ Jones │ 10 │ Paris │
│ S3 │ Blake │ 30 │ Paris │
│ S5 │ Adams │ 30 │ Athens │
└─────┴───────┴────────┴────────┘
Fig. 4.1: Relvars S, LS, and NLS—sample values
Now let me remind you of The Principle of Interchangeability , which says there shouldn't
be any arbitrary and unnecessary distinctions between base relvars and views (i.e., views should
“look and feel” just like base relvars so far as users are concerned). One consequence of that
principle, in the case at hand, is that the behavior of relvars S, LS, and NLS shouldn't depend on
which of them are base relvars and which of them are views. Until further notice, therefore, let's
suppose they're all base relvars:
1 Under the proposals of the paper “Inclusion Dependencies and Foreign Keys,” in Database Explorations: Essays on The Third
Manifesto and Related Topics , by Hugh Darwen and myself (Trafford, 2010), we could say {SNO} in relvar S is a foreign key as
well, referencing the key {SNO} of the disjoint union of relvars LS and NLS.
Search WWH ::




Custom Search