Reputation: 149
I have read about Keys in RDBMS. https://stackoverflow.com/a/6951124/1647112 I however couldn't understand the need to use a candidate key. If a primary key is all that is needed to uniquely identify a row in a table, why is candidate key required? Please give a good example as to state the differences and importance of various keys. Thanks in advance.
Upvotes: 3
Views: 2736
Reputation: 149
From, the above answer i came to this conclusion
Super key(one or more attributes used for selecting one or more rows)
||
\/
Candidate key(one or more attributes from super used for selecting a single row)
||
\/
Primary key(one attribute among candidate keys used for selecting a single row)
Am i correct?
Upvotes: 0
Reputation: 499362
A table can have one or more candidate keys - these are keys that uniquely identify a row in the table.
However, only one of these candidate keys can be chosen to be the primary key.
Upvotes: 5