Bird
0
0

Why might a UNIQUE constraint be preferred over a PRIMARY KEY constraint on a column?

hard📝 Conceptual Q10 of 15
SQL - Table Constraints
Why might a UNIQUE constraint be preferred over a PRIMARY KEY constraint on a column?
AUNIQUE constraints cannot be dropped, PRIMARY KEY can
BUNIQUE automatically creates an index, PRIMARY KEY does not
CPRIMARY KEY allows duplicates, UNIQUE does not
DUNIQUE allows multiple NULLs, PRIMARY KEY does not
Step-by-Step Solution
Solution:
  1. Step 1: Compare UNIQUE and PRIMARY KEY constraints

    PRIMARY KEY requires unique and NOT NULL values; UNIQUE enforces uniqueness on non-NULL values and permits multiple NULLs.
  2. Step 2: Identify key difference

    UNIQUE allows multiple NULLs, which PRIMARY KEY does not.
  3. Final Answer:

    UNIQUE allows multiple NULLs, PRIMARY KEY does not -> Option D
  4. Quick Check:

    UNIQUE permits NULLs, PRIMARY KEY forbids them [OK]
Quick Trick: UNIQUE allows NULLs; PRIMARY KEY requires NOT NULL [OK]
Common Mistakes:
MISTAKES
  • Thinking PRIMARY KEY allows NULLs
  • Believing UNIQUE does not create indexes
  • Confusing drop behavior of constraints

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes