1. Database modi cations can cause violations of referential integrity. To preserve the referential integrity constraint
â…¡(r2) ∈ â…¡K1(r1)
in the following operations:
-
Insert: if a tuple t2 is inserted into r2, the system must ensure that there is a tuple t1 in r1 such t1[K] = t2[α], i.e.
t2[α]∈ â…¡K(r1)
- Delete: if a tuple t1 is deleted from r1, the system must compute the set of tuples in r2 that reference t1:
∑α=t1[K](r2)
If this set is not empty, either reject delete command, or delete also the tuples that reference t1.
-
Update: two cases
- updates to referencing relation: test similar to insert case must be made, ensuring if t'2 is new value of tuple,t'2[ α] ∈ â…¡K(r1)
- updates to referenced relation: test similar to delete if update modi es values for primary key, must compute
∑α=t1[K](r2)
to ensure that we are not removing a value referenced by tuples in r2.
