Sunday, September 15, 2019

Keys in DBMS

Keys

KEYS IN DBMS

An entity type usually has an attribute whose values are different from each individual entity. In the entity set such as attribute is called a key attribute or simply a key allows us to identify a set of attributes that is sufficient to differentiate entity from each other. They also help to identity the relationship and this way differentiate relationship from each other.
1) Super Key
2) Candidate Key 
3) Primary Key


1) Super Key: -


A super key is a set of one or more attributes which are taken collectively to identify uniquely entity in an entity set.
For example: -
Roll_No attribute of the entity set student is sufficient to differentiate one entity from another however, student is not a super key. Because many students might have the same name.

2) Candidate Key: -


A super key may contain some extra and DBMS purpose is we want minimum super keys. Hence, we want to have a super key for which no proper subset is super key. Such minimal super key is called candidate key.
Student_name, and student_branch is sufficient to distinguish among member of a student entity set then, student_Rollno, [student_branch, stu_name] are candidate key.
Although the student_rollno and stu_name together can differentiate student empty. There combination well from candidate key.

3) Primary Key: -


The term primary key is used to denote a candidate key that is chosen by the database design as a principle.
For example –
Roll_no is a primary key of student entity set and are guaranteed to be chosen such that its attributes are never or very rarely changed.


No comments:

Post a Comment