The following table has two attributes and where is the primary key and is the foreign key referencing with on-delete cascade.
The set of all tuples that must be additionally deleted to preserve referential integrity when the tuple is deleted is:
View worked solution
Answer: C
The referential integrity constraint states that the foreign key references the primary key with an on-delete cascade policy. This means that if a tuple with primary key value is deleted, all tuples with foreign key value must also be automatically deleted.
Let's trace the cascade deletion step-by-step starting with the deletion of the tuple :
-
Delete :
This removes the primary key value from the relation. -
Cascade to :
We must delete all tuples where the foreign key . Looking at the table, these tuples are: -
Cascade from the newly deleted tuples:
- Deleting removes the primary key value . Thus, we must delete all tuples where . The only such tuple is .
- Deleting removes the primary key value . Thus, we must delete all tuples where . There are no such tuples in the table.
-
Cascade from :
Deleting removes the primary key value . Thus, we must delete all tuples where . There are no such tuples in the table.
Therefore, the set of all tuples that must be additionally deleted to maintain referential integrity is , , and .
Free practice · Your answers on this page are not saved.
