Saturday, December 8, 2018

What is the difference between Candidate,Composit and Super key in DBMS.

Candidate Key A Candidate Key can be any column or a combination of columns that can qualify as unique key in database. There can be multiple Candidate Keys in one table. Each Candidate Key can qualify as Primary Key. 


For Example, STUD_NO in STUDENT relation.
  • The value of Candidate Key is unique and non-null for every tuple.
  • There can be more than one candidate key in a relation. For Example, STUD_NO as well as STUD_PHONE both are candidate keys for relation STUDENT.
  • The candidate key can be simple (having only one attribute) or composite as well. For Example, {STUD_NO, COURSE_NO} is a composite candidate key for relation STUDENT_COURSE.
Super Key: The set of attributes which can uniquely identify a tuple is known as Super Key. 


For Example, STUD_NO, (STUD_NO, STUD_NAME) etc.


  • Adding zero or more attributes to candidate key generates super key.
  • A candidate key is a super key but vice versa is not true.
Composite Key: Combination of two or more columns in a table when used to identify each row of a table then it is know as Composite key.

Note : It may be Candidate key or Primary key.

No comments:

Post a Comment

How to pass values using Setter and Constructor injuction ?

Setter Injection  <bean id= "obj"   class = "com.java.Employee" >            <property name= "id&q...