ER-to-Relational Mapping — Supertypes and Subtypes When mapping a supertype/subtype hierarchy into relations, which statement correctly captures the key assignment across the hierarchy?

Difficulty: Easy

Correct Answer: The supertype primary key is assigned to each subtype.

Explanation:


Introduction:
Supertypes and subtypes model specialization. In the relational mapping, maintaining identity across the hierarchy is critical. The conventional approach is to propagate the supertype’s identifier into each subtype, preserving a one-to-one correspondence of rows that share the same identity.


Given Data / Assumptions:

  • A single supertype has one or more subtypes.
  • Each subtype row represents a specialized form of the supertype row.
  • The mapping should preserve shared identity and enable referential integrity.


Concept / Approach:
The standard strategy assigns the supertype’s primary key to every subtype as both the primary key and a foreign key referencing the supertype relation. This guarantees that each subtype row corresponds to exactly one supertype row. Alternatives, such as independent surrogate keys in subtypes, complicate identity management and break the clean one-to-one mapping.


Step-by-Step Solution:
Create a relation for the supertype with its primary key.Create a relation for each subtype.Include the supertype key in each subtype relation as its primary key.Declare that key also as a foreign key referencing the supertype relation.


Verification / Alternative check:
Check entity counts and identity flows: a subtype instance cannot exist without the corresponding supertype instance when total participation applies, and the shared key enforces that relationship neatly.


Why Other Options Are Wrong:

  • Assigning subtype keys upward breaks identity semantics.
  • Claiming no link or no PK/FK relationship ignores the core integrity requirement.
  • Using unrelated surrogate keys in subtypes loses the one-to-one coupling by default.


Common Pitfalls:
Forgetting to declare the subtype key as both primary and foreign key, which weakens integrity across the hierarchy.


Final Answer:
The supertype primary key is assigned to each subtype.

Discussion & Comments

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