Translate

Visit to www.mrmcse.com

07 March 2018

Differentiate among primary key, Candidate key and Supper key with example



Primary Key
Candidate Key
Supper Key
(i) A primary key is candidate key that is chosen by the database designer.
(i) A candidate key is all those set of attributes which can uniquely identify a row.
(i) Any super set of a candidate key is a super key.
(ii) The primary key should be chosen such that its attribute are never or rarely changed.
(ii) Candidate key must be chosen with care. Because there may be many people with the same name.
(ii) The customer name attribute of customer is not a super key because several people might have the same name.
(iii) The primary key as the principal means of identifying entities within as entity set.
(iii) Several sets of attributes could serve as a candidate key.
(iii) The customer id attributes of the entity set customer is sufficient to distinguish one customer entity from another. Thus customer-id is a super key.
(iv) Example:
customer-id.
(iv) Example:
customer-id,
customer-name,
customer-street;

(iv) Example:
The combination of customer-id and customer-name is a super key.




No comments:

Post a Comment