All candidate keys are superkeys, whereas all superkeys are not candidate keys. Justify this statement with a suitable example.
Answer:
A superkey SK
is a subset of attributes of a relation schema R,
such that for any two distinct tuples t1
and t2
in relation state r
of R,
we have t1 [SK]
≠ t2 [SK]
. For example, consider a relation schema BOOK
with three attributes ISBN, Book_title,
and Category.
The value of ISBN
is unique for each tuple; hence, {ISBN
} is a superkey. In addition, the combination of all the attributes, that is, {ISBN, Book_title, Category}
is a default superkey for this relation schema.
Generally, all the attributes of a superkey are not required to identify each tuple uniquely in a relation. Instead, only a subset of attributes of the superkey is sufficient to uniquely identify each tuple. Further, if any attribute is removed from this subset, the remaining set of attributes can no longer serve as a superkey. Such a minimal set of attributes, say K,
is a candidate key (also known as irreducible superkey). For example, the superkey {ISBN, Book_title, Category}
is not a candidate key, since its subset {ISBN}
is a minimal set of attributes that uniquely identify each tuple of BOOK
relation. So, ISBN
is a candidate key as well as superkey. Hence, it is concluded that all candidate keys are superkeys, whereas all superkeys are not candidate keys.
Related Articles:
This section is dedicated exclusively to Questions & Answers. For an in-depth exploration of Database Management System, click the links and dive deeper into this subject.
Join Our telegram group to ask Questions
Click below button to join our groups.