When should you use a supertype/subtype structure? Specifically, is it appropriate when certain attributes apply only to some instances of an entity type (and not to all)?

Difficulty: Easy

Correct Answer: Correct

Explanation:


Introduction / Context:
Enhanced ER modeling uses specialization (subtypes) to avoid excessive nulls and to encapsulate attributes that only make sense for particular categories of an entity. This question evaluates whether you recognize the classic trigger for introducing subtypes.



Given Data / Assumptions:

  • A base entity has a common identity and shared attributes.
  • Some additional attributes are relevant only for a subset of instances.
  • We aim to improve integrity, clarity, and maintainability.


Concept / Approach:
If attributes apply to only some instances (for example, a Vehicle that is sometimes a Truck with payload_capacity), creating subtypes prevents storing irrelevant attributes (nulls) on the supertype and supports rules unique to each category. The model can mark the specialization as disjoint or overlapping and total or partial, based on business rules. Implementation options include a discriminator column, separate subtype tables keyed by the supertype’s primary key, or a single-table structure with constraints.



Step-by-Step Solution:

Identify attribute groups that are conditional (apply only to certain categories).Define subtypes whose members require those attributes.Specify disjoint/overlapping and total/partial constraints.Choose an implementation strategy that enforces subtype-specific constraints efficiently.


Verification / Alternative check:
Check sample data for many nulls in certain columns; this typically indicates that subtype partitioning would yield a cleaner schema with better integrity and simpler queries.



Why Other Options Are Wrong:

  • “Incorrect” contradicts mainstream ER guidance.
  • Restrictions to “only overlapping” or “only disjoint” conflate the trigger (conditional attributes) with the choice of constraint type.


Common Pitfalls:
Creating subtypes for convenience without a clear rule difference; or failing to enforce subtype membership via constraints and application logic, which allows inconsistent data.



Final Answer:
Correct

Discussion & Comments

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