Difficulty: Easy
Correct Answer: Incorrect
Explanation:
Introduction / Context:
Oracle sequences generate numeric values, often used to populate surrogate key columns. However, correctness for keys includes uniqueness and referential integrity. This question examines whether using a sequence alone “guarantees valid surrogate key values.”
Given Data / Assumptions:
Concept / Approach:
A sequence is just a number generator. It does not check table contents and cannot prevent duplicates if two different sequences or manual inserts generate conflicting values. The validity of a surrogate key is guaranteed by defining a PRIMARY KEY or UNIQUE constraint on the column that receives sequence values. Identity columns (12c+) pair generation with a constraint-friendly design, but uniqueness still comes from constraints. Therefore, the presence of a sequence alone does not guarantee “valid” keys; it merely supplies candidate values.
Step-by-Step Solution:
Verification / Alternative check:
Attempt to insert a manual duplicate value; the constraint blocks it. Restart the instance—observe sequence gaps but no impact on uniqueness enforcement.
Why Other Options Are Wrong:
Common Pitfalls:
Assuming sequences enforce uniqueness; not declaring constraints; relying on sequence order for business meaning.
Final Answer:
Incorrect
Discussion & Comments