Databases Reference
In-Depth Information
Of these, I've already discussed the first case in the previous section—except now let me point
out that, of course, intersection is a special case of join, and so the ideas illustrated in that
previous section can surely be generalized to deal with join views too. But let's consider
examples of the other two cases.
Union
First union. Consider the following update on the union view ULK:
INSERT RELATION { TUPLE { PNO 'P4' } } INTO ULK ;
(The expression RELATION {TUPLE {PNO 'P4'}} is a relation selector invocation, denoting
the relation containing just the specified tuple.) According to the rules described in Chapter 10,
then, the effect of this insert is to cause the specified tuple to be inserted into both PL and PK,
although the desired effect—inserting the tuple into ULK—could be achieved by inserting that
tuple into either PL or PK, and there's no apparent need to insert it into both.
But consider the user once again ( U , say) who issues the foregoing insert. Suppose for
simplicity that ULK is the only relvar user U is aware of—i.e., user U doesn't even know relvars
PL and PK exist. Despite this lack of awareness, user U must nevertheless be aware that the
predicate for ULK is of the form ON_SALE OR IN_STOCK (where again ON_SALE stands for
Part PNO is on sale and IN_STOCK stands for Part PNO is in stock ). So if user U wants to
insert the tuple for part P4 into ULK, it must necessarily be the case that he or she wants to do so
because he or she knows that exactly one of the following possibilities holds:
1. Part P4 is now on sale (but not in stock).
2. Part P4 is now in stock (but not on sale).
3. Part P4 is now both on sale and in stock.
What's more, of course, user U must also know which one of these possibilities is in fact
the case. Suppose for the sake of the example that it's Possibility 2. Then the user can and
should issue the following insert:
INSERT RELATION { TUPLE { PNO 'P4' } } PRED ( IN_STOCK ) INTO ULK ;
Now the new tuple will be inserted into relvar PK (only).
 
Search WWH ::




Custom Search