Candidate Key
A candidate key is a super key that contains no extra attribute. It consists of minimum possible attributes. It is a combination of attributes that can be individually used to recognize a database record without referring to any other data. A superkey like {Registration No, Name} contains an extra field name. It can be used to identify a tuple uniquely in the relation, but it does not consist of a minimum possible attribute as only Registration No. can be used to identify a tuple in a relation. It means that {Registration No, Name} is a superkey but it is not a candidate key because it contains an extra field. On the other hand, Registration No is a superkey as well as a candidate key. They are individual columns in a table that qualifies for the uniqueness of all the rows. This is generally the best among the candidate keys to use for identification.
Properties of the candidate key for the lifetime –
- the attribute used for identification must remain the same.
- the value cannot be null.
- the key must be unique.