Reverse-engineering an existing database: When assessing the structure of an acquired set of tables with data, assessing the validity of possible referential integrity constraints on foreign keys is (part of) the ________.

Difficulty: Easy

Correct Answer: third step.

Explanation:


Introduction / Context:
After identifying keys, the next task is to verify whether foreign keys truly reference valid primary keys and whether the data satisfies referential integrity (RI). This check confirms that relationships behave as intended and uncovers orphaned rows or modeling errors.



Given Data / Assumptions:

  • A sequence is followed for clarity: 1) primary keys, 2) foreign keys, 3) validate RI, 4) analyze dependencies/normalization.
  • Real data may contain historical inconsistencies.
  • We must test the hypothesized constraints against actual rows.


Concept / Approach:

RI validation typically occurs after hypothesizing foreign keys. Only then can you run anti-joins or NOT EXISTS checks to find child rows without matching parents. This positions RI validation naturally as the third step in a structured reverse-engineering workflow.



Step-by-Step Solution:

Determine primary keys first to define parent uniqueness.Identify candidate foreign keys by name and data similarity.Validate RI using queries that detect orphans and mismatched types.


Verification / Alternative check:

Run SELECTs with LEFT JOIN and WHERE parent.key IS NULL to locate violations; count violations and sample rows to confirm.



Why Other Options Are Wrong:

Placing RI checks as the first or second step is premature before keys are identified; as fourth misses early detection of serious defects.



Common Pitfalls:

Inferring RI solely from column names; ignoring soft-deletion flags that break relationships.



Final Answer:

third step.

More Questions from Database Design Using Normalization

Discussion & Comments

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