Databases Reference
In-Depth Information
(S2,10) from ST and (10,Paris) from TC “simultaneously.” Again this update succeeds (it
has the effect of deleting (S2,10,Paris) from S); however, it seems to reasonable in this case
to say the DELETE on TC should happen anyway, regardless of whether we request it
explicitly (see 1. above).
Considerations such as the foregoing suggest the following rules:
ON DELETE d FROM ST :
DELETE ( S MATCHING d ) FROM S ;
ON INSERT i INTO ST :
INSERT ( i JOIN TC ) INTO S ;
Given these rules, the foregoing INSERT and DELETE examples all work as described.
Explicit UPDATE operations are another matter, however. In fact, it seems that most such
operations, on either ST or TC, will either fail or have undesirable side effects. By way of
example, you might like to consider what happens if we try to update ST, changing the status for
supplier S2 to (a) 40, (b) 20, (c) 30, or changing the supplier number for supplier S1 to S9.
(Analogs of all of these updates can certainly be done on relvar S, of course.) And the reason for
this state of affairs is, of course, that the two designs—S by itself and the combination of ST and
TC—aren't information equivalent; to be specific (and to repeat), the fact that a given supplier is
in a given city can be represented in the former design but not, in general, in the latter. Thus,
while such explicit UPDATE operations can certainly be requested, they probably shouldn't be.
Now, once again I'll complete my investigation into the example overall by (a) considering
the projection relvars independently of relvar S, (b) considering what happens if the user sees
just one of those projection relvars, and (c) considering what happens if those relvars are
views—but again I don't think you'll find any surprises in those discussions. What you might
find a little surprising, however, is that the update rules I've given for the example overall are
extremely similar, if not quite identical, to the rules I gave earlier for Examples 1 and 2. (To
repeat, they're similar, but—speaking very loosely—updates are more likely to fail in the case of
Example 3 than they are in the case of Examples 1 and 2.) It seems to me, therefore, that
examples like the ones discussed in this chapter should suffice as a basis on which to define a set
of rules for updating projections in general.
The Projection Relvars
Consider a user who sees just the projection relvars ST and TC. That user:
 
Search WWH ::




Custom Search