CompTIA Tech+ (FC0-U71)Data and Database FundamentalsEasy
A technician is designing a Products table and wants a column, separate from the primary key, that also guarantees no two rows share the same value. Which type of key should be applied to this column?
- ASurrogate key
- BUnique key
- CComposite key
- DForeign key
Show answer & explanationAnswer & explanation
Correct answer: B. Unique key
A unique key enforces that all values in a column are distinct across rows, but unlike the primary key, a table can have more than one unique key. This is useful for columns like a product SKU that must never repeat.
Why the other options are wrong
- A. A surrogate key is an artificial identifier, not a term for enforcing uniqueness on a secondary column.
- C. A composite key combines multiple columns to form a primary key, not a single-column uniqueness rule.
- D. A foreign key references a primary key in another table, it does not enforce uniqueness by itself.
Unique Key
A column or set of columns constrained so that all values are distinct, but which is not the table's primary key.
- A table can have multiple unique keys but only one primary key.
- Unique keys can allow one NULL value depending on the database system.
- Commonly used for natural identifiers like email or SKU.
Memory trick: Primary is the boss key, Unique is a backup boss key.