Databases Reference
In-Depth Information
Chapter 9
I n t e r s e c t i o n V i e w s
Updating intersections
Can sometimes need corrections
—Anon.:
Where Bugs Go
In this chapter and the next two, I turn my attention to intersection, union, and difference views.
Of course, I've already said something in Chapter 6 about intersection views in particular (the
subject of the present chapter)—recall that intersection is a special case of one to one join—but
there's quite a lot more to be said on the subject.
First I need to say something about the structure of the chapter. Let
DB1
and
DB2
be a set
of base relvars and a set of views, respectively. Now, in the last few chapters, on restriction,
projection, and join views, I proceeded in general terms as follows: First, I considered a
particular
DB1
; then I considered a particular
DB2
that was information equivalent to that
DB1
;
finally, I considered another
DB2
that wasn't information equivalent to that
DB1
but involved
some information hiding instead. But that approach doesn't work very well for intersection
views.
1
The reason is this: Suppose
DB1
consists of base relvars
A
and
B
(only) and
DB2
consists of view
V
only, defined as the intersection of
A
and
B
(i.e.,
V
=
A
INTERSECT
B
)
.
Then
DB2
will be information equivalent to
DB1
only if
A
=
B
—in which case (as I hinted in a
footnote near the end of Chapter 6) there's not much point in defining view
V
in the first place.
So there's not much point in considering the case in which
A
and
B
are equal. What's
more, there's also not much point in considering the case in which they're totally disjoint, in the
sense that no tuple ever appears in both. For if they're disjoint in this sense, then the intersection
view
V
will always be empty; deletes on
V
will thus always be “no ops” and inserts on
V
will
always fail (unless they're “no ops” as well). So the interesting case—the one I do want to
examine—is the one in which
A
and
B
aren't equal but do at least overlap, in the sense that it's
possible for the very same tuple to appear in both. Thus, I'll consider two principal examples,
one in which the overlap is explicit (and I'll explain what I mean by that term), and one in which
it's merely implicit. Also, I won't bother to examine in either case the situation in which all
relvars concerned are base ones; instead, I'll start with two given relvars
A
and
B
and
immediately define their intersection
A
INTERSECT
B
as a view per se, and see what happens.
1
It also doesn't work very well (for different reasons) for union or difference views, the topics of the next two chapters.