A table has two candidate keys, one of which is chosen as the primary key. How many alternate keys does this table have ?
A table has two candidate keys, one of which is chosen as the primary key. How many alternate keys does this table have ?
Options
Correct option: (B) 1
Out of the two candidate keys, one becomes the primary key and the remaining one automatically becomes an alternate key, so the table has exactly 1 alternate key.
Marking Scheme
- 11 mark: correct option (B) 1 selected.
Hint
Alternate keys = total candidate keys minus the one chosen as primary key.
Quick Oral Answer
Alternate keys are the candidate keys not chosen as the primary key; with 2 candidate keys and 1 chosen as primary, exactly 1 remains as an alternate key.
Analysis & Explanation
This question tests the relationship between candidate keys, primary keys, and alternate keys in the relational data model.
Why (B) is correct
- A candidate key is any attribute (or set of attributes) that can uniquely identify a tuple.
- When a table has more than one candidate key, only one is selected to be the primary key.
- Every other candidate key that is NOT chosen as the primary key is called an alternate key.
- Here, there are 2 candidate keys; 1 becomes the primary key, so the remaining candidate key becomes the alternate key.
Why the other options are wrong
- (A) 0 would be true only if there were just one candidate key in total.
- (C) 2 wrongly assumes the primary key itself is also counted as an alternate key.
- (D) 3 has no basis — the table only has 2 candidate keys in total, so there cannot be 3 alternate keys.
Common Mistakes
- 1Counting the primary key itself as an alternate key.
- 2Confusing candidate keys with all unique attributes of the table rather than just the minimal identifying sets.
Interesting Facts
The concept of candidate keys, primary keys and alternate keys comes from E.F. Codd's relational model proposed in 1970, which forms the theoretical basis of all modern RDBMS like MySQL and Oracle.
A table can have a composite candidate key made of two or more columns together, and such a combination can also become an alternate key if not chosen as primary.
Spotted a mistake or something unclear?
Tell us — we fix reported answers fast.
Frequently Asked Questions
What is the difference between a candidate key and a primary key?
A candidate key is any minimal set of attributes that can uniquely identify each row in a table; a table can have multiple candidate keys. The primary key is the one candidate key that the database designer selects as the main identifier for the table; only one primary key is allowed per table.
Can a table have zero alternate keys?
Yes. If a table has only one candidate key, that single key must be chosen as the primary key, leaving zero alternate keys.