Databases Reference
In-Depth Information
4.15 Here I think it might be helpful to give part of the
Tutorial D
grammar for
<relation assign>
, which is the
fundamental relational update operator in
Tutorial D
. (The names of the syntactic categories are meant to be
intuitively self-explanatory.)
<relation assign>
::=
<relvar name>
:=
<relation exp>
|
<insert>
|
<delete>
|
<update>
<insert>
::= INSERT
<relvar name> <relation exp>
<delete>
::= DELETE
<relvar name>
<relation exp>
| DELETE
<relvar name>
[ WHERE
<boolean exp>
]
<update>
::= UPDATE
<relvar name>
[ WHERE
<boolean exp>
] :
{
<attribute assign commalist>
}
And an
<attribute assign>
, if the attribute in question is relation valued, is basically just a
<relation assign>
(except that the pertinent
<attribute name>
appears in place of the target
<relvar name>
in that
<relation assign>
),
and that's where we came in. Here then are
Tutorial D
statements for the required updates:
a.
INSERT SP RELATION { TUPLE { 'S2' , 'P5' , 500 } } ;
b.
UPDATE SPQ WHERE SNO = 'S2' :
{ INSERT PQ RELATION { TUPLE { PNO 'P5' , QTY 500 } } } ;
4.16
No answer provided
—except to note that I was just as confused as everybody else, back in 1995! (But at
least I corrected my error in subsequent editions of the subject topic.)
CHAPTER 5
5.1 The join of a single relation, JOIN{
r
}, is just
r
; the join of no relations at all, JOIN{}, is TABLE_DEE (the
only relation of degree zero and cardinality one). For further explanation, see
SQL and Relational Theory
.
5.2
See the body of the chapter.
5.3 FDs c. and d. (only) are trivial. All eight FDs a.- h. are satisfied by the current value of relvar S. All but h.
hold in relvar S. FDs a., c., e., and g. are irreducible with respect to relvar S; FDs b., d., and f. are reducible. (As for
h., the question of irreducibility doesn't arise, since that FD doesn't hold in the relvar. Check the definition of FD
irreducibility if you don't immediately grasp this point.)
5.4 Heath's Theorem (original version) says that if (a) relation
r
has heading
H
, (b)
X
,
Y
, and
Z
are subsets of
H
whose union is equal to
H
, and (c)
r
satisfies the FD
X
→
Y
, then (d)
r
is equal to the join of its projections on
XY
and
XZ
(where
XY
denotes the union of
X
and
Y
, and similarly for
XZ
). In what follows, I show the proof of this
theorem in exhaustive detail.
Note:
The expression “
t
∈
r
” can be read as “tuple
t
appears in relation
r
.”
First of all, consider the simplest possible case, in which
X
,
Y
, and
Z
are singleton sets (i.e., contain just one
attribute each). Let the attributes in question be
A
,
B
, and
C
, respectively. Now, we know from the answer to
Exercise 3.2 that no tuple of
r
is lost by taking the projections
r1
over
XY
(= {
A
,
B
}) and
r2
over
XZ
(= {
A
,
C
}),