Chapter 11. Difference Views
I’ll teach you differences: away, away!
—
In this chapter I’ll consider the question of updating through the relational difference operator (MINUS, in Tutorial D). Now, I’m sure you won’t be surprised to learn the chapter is fairly similar in structure to its immediate predecessors, on intersection and union. However, it also differs—how appropriate!—in certain important respects, as you’ll quickly see. To elaborate briefly: Suppose we’re given two relvars A and B. Clearly, if A = B, the difference A MINUS B and the difference B MINUS A are both empty, so that case isn’t very interesting. Also, if A and B are disjoint, then A MINUS B is equal to A and B MINUS A is equal to B, so that case isn’t very interesting either. So the interesting case is the one in which A and B aren’t equal but do overlap. As in Chapter 9, therefore (on intersection), I’ll consider two examples, one in which the overlap is explicit and one in which it’s merely implicit. For reasons that will become clear later, however, this time I want to consider the implicit case first.
Example 1: Implicit Overlap
My first example is based once again on the “parts on sale” vs. “parts in stock” example from Chapters Chapter 9 and Chapter 10. Once again, then, we have two relvars PL and PK, each with just a single attribute PNO—relvar PL gives part numbers for parts on sale, and relvar PK gives part numbers for parts in stock. Now, there are obviously two possible differences ...
Get View Updating and Relational Theory now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.