Saturday, 17 March 2012

Define candidate key, alternate key, composite key.

Any attribute that is uniquely identify a row in a table is 
candidate key for the table. We select one of the candidate 
key as Primary key. All candidate keys which are not chosen 
as "primary key" are Alternate keys. The key which uniquely 
identify the rows of the table  and which is made up of 
more than one attribute is called Composite key.
Example: 
In a class we have to select Class Monitor. 
So A, B,C and D stand for that post. So A,B,C and D are 
candidate for monitor so these are candidate key. We select 
B as monitor so B is primary key and A,C and D can be 
monitor but not selected as a monitor so they are 
alternative choice. So A,C and D are alternate key.
When two students of class work together in a project than 
they are composite key for the class.

No comments:

Post a Comment