Differentiate between a superkey, a candidate key and a primary key.

Database Management System >   Keys in DDMS >   Super Key  

Long Question

1395


Answer:

A set of one or more attributes, when taken together, helps in uniquely identifying each entity is called a superkey. For example, the attribute P_ID of the entity type PUBLISHER can be used to uniquely identify each entity instance. Thus, P_ID is a superkey. The combination of the attributes P_ID and Name is also a superkey. One can also use the set of all attributes (P_ID, Name, Address, Phone, Email_ID) to uniquely identify each entity instance of the type PUBLISHER. Thus, the combination of all attributes is also a superkey.

However, P_ID itself can uniquely identify each entity instance, thus, other attributes are not required. Such a minimal superkey that does not contain any superfluous (extra) attribute in it is called a candidate key. A candidate key contains a minimized set of attributes that can be used to uniquely identify a single entity instance. For example, the attributes P_ID and Name are the candidate keys. However, the combination of P_ID and Name is not a candidate key. The candidate key, which is chosen by the database designer to uniquely identify entities, is known as the primary key. For example, the attribute P_ID can be chosen as the primary key. If a primary key is formed by the combination of two or more attributes, it is known as a composite key. A composite key must be minimal, that is, all the attributes that form the composite key must be included in the key attribute to uniquely identify the entities.


This Particular section is dedicated to Question & Answer only. If you want learn more about Database Management System. Then you can visit below links to get more depth on this subject.




Join Our telegram group to ask Questions

Click below button to join our groups.