Let and be two relation schema, where the primary keys are shown underlined, and let C be a foreign key in referring to . Suppose there is no violation of the above referential integrity constraint in the corresponding relation instances and . Which of the following relational algebra expressions would necessarily produce an empty relation?
View worked solution
Answer: B
The question asks which relational algebra expression will necessarily produce an empty relation under the given referential integrity constraint.
We are given:
- with primary key .
- with primary key .
- is a foreign key in referencing the primary key in .
By the definition of referential integrity, every value in the foreign key column of relation instance must exist in the primary key column of relation instance . In terms of relational algebra, this subset relationship is expressed as:
Let us analyze the options based on this set inclusion property:
- : Since , this expression represents elements in that are not referenced by . This set can be non-empty if there are primary key values in that have no matching records in .
- : Since every element in must also be in (due to the subset constraint ), subtracting from will always yield an empty relation.
- : This performs a theta-join where . This can easily produce a non-empty relation if there are multiple distinct keys in .
- : This is an inner join on the foreign key constraint, which yields the set of all referenced values . This is non-empty as long as contains at least one tuple.
Thus, only option B is guaranteed to be empty under all valid instances.
Free practice · Your answers on this page are not saved.
