Consider two relations R(A,B) and S(E,C). A is primary key and E is a FK referring A. Which of the following operations never violate FK constraint?
Correct Answer :
Insert in R
Delete from S
Solution :
The correct options are Insert in R and Delete from S.
To understand why these operations never violate the Foreign Key (FK) constraint, let us analyze the relationship between the two relations, and .
Here, is the Primary Key (PK) of relation , and is a Foreign Key in relation that references in relation . The Foreign Key constraint requires that every value of in must either be null (if allowed) or exist as a value of in . That is, (excluding null values).
Let us evaluate each operation to see how it affects this constraint:
1. Insert in R:
When we insert a new tuple into the referenced relation , we add a new primary key value to . This expands the set of valid values that the foreign key can reference. Since it does not remove any existing primary keys, it cannot cause any foreign key in to point to a non-existent primary key in . Therefore, inserting into can never violate the foreign key constraint.
2. Delete from S:
When we delete a tuple from the referencing relation , we remove a foreign key value . Since the constraint only requires that existing foreign key values in must exist in , removing a row from simply reduces the referencing set. It cannot create an orphaned reference because we are removing references, not adding them. Therefore, deleting from can never violate the foreign key constraint.
For completeness, let us look at the other options:
- Insert in S: If we insert a tuple into with a foreign key value that does not exist in , the constraint is violated.
- Delete from R: If we delete a tuple from whose primary key is currently being referenced by some tuple's foreign key in , the constraint is violated (unless cascade actions are specified).
Access expert-curated educational resources and study materials—completely free.
Create, conduct, and manage professional online assessments with Mindyard. Perfect for teachers and institutes.
Copyright © 2026 Mindyard. All Rights Reserved.