Databases Reference
In-Depth Information
Finally, we coalesce T3 on DURING to obtain the desired result:
T3 COALESCE DURING
The result looks like this:
S#
DURING
S2
[d07, d07 ]
S3
[d03, d07 ]
S5
[d02, d10 ]
Here then is a formulation of Query 4.2 as a single nested expression:
((S_DURING {S#, DURING} UNFOLD DURING)
MINUS
(SP_DURING UNFOLD DURING))
COALESCE DURING
As already indicated, the overall operation denoted by this expression is
an example of what some writers call temporal difference. More precisely, it
is a temporal difference between the projections of S_DURING and
SP_DURING (in that order) over S# and DURING. Note that, like tempo-
ral projection, temporal difference is not exactly a difference as such but is,
rather, a temporal analog of an ordinary difference.
We are not quite done here, however. Temporal difference expres-
sions like the one shown in the example are required so frequently in practice
that it seems worthwhile defining a still further shorthand for them.
12
To
be specific, it seems worth capturing as a single operation the sequence (a)
unfold both operands, (b) take the difference, and then (c) coalesce. Here is
our proposed further shorthand:
R1 I_MINUS R2 ON A
R1 and R2 are relational expressions denoting relations r1 and r2 of the same
type and A is an attribute of some interval type that is common to those two
relations (and the prefix I_ stands for interval, of course). As we have
12. Note that (by contrast) we did not define a special shorthand for temporal projection.
 
Search WWH ::




Custom Search