Managing parent changes when children depend on the parent:\n“When the parent entity is required, cascading updates and cascading deletions should be allowed or parent actions should be prohibited.”\nChoose the best assessment.

Difficulty: Easy

Correct Answer: Correct

Explanation:


Introduction / Context:
When a child is existence-dependent on a parent, we must decide what happens if the parent’s key changes or the parent row is deleted. The two safe strategies are to cascade the change to keep children valid or to prohibit the parent action to protect referential integrity.



Given Data / Assumptions:

  • The child has a NOT NULL foreign key to the parent (mandatory on the child side).
  • Referential integrity options include ON UPDATE/DELETE CASCADE, RESTRICT/NO ACTION, SET NULL, and SET DEFAULT.
  • Business rules do not permit orphaned child rows.


Concept / Approach:
If the child requires a parent, then after any parent key update or delete, children must remain valid. Two broad patterns satisfy this: (1) CASCADE the update/delete so children follow the parent’s change, or (2) RESTRICT/NO ACTION to prevent the parent change if children exist. SET NULL or SET DEFAULT would violate the child’s mandatory dependency unless the foreign key were nullable or a default valid parent existed—conditions that contradict “parent required.” Hence, “cascade or prohibit” is the correct design guideline.



Step-by-Step Solution:

Model foreign key as NOT NULL (mandatory child).For updates/deletes on the parent, choose ON UPDATE/DELETE CASCADE or RESTRICT/NO ACTION.Avoid SET NULL when NOT NULL FK is required; avoid SET DEFAULT unless the default references a valid parent that satisfies business rules.Result: integrity is maintained without orphans.


Verification / Alternative check:
Attempt parent delete with children present under RESTRICT → blocked; under CASCADE → children removed automatically. Either preserves integrity according to policy.



Why Other Options Are Wrong:

  • Limiting to updates ignores the delete case; both require handling.
  • Foreign key nullability and isolation level do not dictate the design choice; the dependency does.


Common Pitfalls:
Allowing SET NULL with a NOT NULL child foreign key; silently creating orphans by manual deletes without constraints; misunderstanding NO ACTION vs RESTRICT timing differences.



Final Answer:
Correct

More Questions from Data Models into Database Designs

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion