Posts

Showing posts with the label Candidate key

Keys in DBMS

Individual entities are distinct and the difference among them is expressed through attributes. The values of the attributes should be such that it uniquely identifies the values of the entities. In other words, no two entities are allowed to have same value for all the attributes. Hence a Key is used to identify a set of attributes, relationships, and thus distinguish entities and relationships from each other. 1. Entity Set A superkey is a set of one or more attributes that allows us to uniquely identify an entity in entity set. For example, the customer_id attribute of entity set customer distinguishes one customer from another. Hence, customer_id is a superkey. The customer_name attribute of entity customer cannot be superkey because, two customers can have same name. Another example, the combination of customer_id and customer_name is also a superkey for entity customer. The superkey which does not have any subset is known as candidate key (or primary key) . For examp