Skip to main contentSkip to solution

Which of the following should be unique in a database?

(A). Candidate key

(B). Foreign key

(C). Primary key

(D). Composite key

Solution

✅ Correct Option: 4

A candidate key is a minimal set of attributes that uniquely identifies every row. The primary key is the candidate key chosen to identify rows, so it must be unique and non-null. A composite key is a key made of two or more attributes whose combination uniquely identifies a row. Each column alone may repeat, but the combination cannot.


Foreign key (Options 2 and 3): it only refers to a key in another table, so its values can repeat (many orders can belong to one customer) and can be null.

Option 1: it leaves out the composite key, which is also unique as a combination of attributes.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question