Thursday, 3 January 2013

Explain the distinctions among the terms primary key, candidate key, and superkey.

Answer: A superkey is a set of one or more attributes that, taken collectively, allows us to identify uniquely an entity in the entity set. A superkey may contain extraneous attributes. If K is a superkey, then so is any superset of K. A superkey for which no proper subset is also a superkey is called a candidate key. It is possible that several distinct sets of attributes could serve as candidate keys. The primary key is one of the candidate keys that is chosen by the database designer as the principal means of identifying entities within an entity set.

Q) Construct an E-R diagram for a car-insurance company whose customers own one or more cars each. Each car has associated with it zero to any number of recorded accidents.


ERE-R diagram for a Car-insurance company



Q) Construct an E-R diagram for a hospital with a set of patients and a set of medical doctors. Associate with each patient a log of the various tests and examinations conducted.


ERE-R diagram for a hospital.


Related Topics : Interview Questions on Object Oriented Analysis & Design

No comments:

Post a Comment