Hi,
Candidate key:
It is important to have an attribute in a table that uniquely identifies a row. An attribute or set of attributes that uniquely identifies a row is called a Candidate key. This attribute has values that are unique. Consider the table Vehicle. The values of the attributes Serial#, Regn# and description are unique in every row. Therefore, all three are Candidate keys. A candidate key can also be referred to as a Surrogate key.
Primary key:
The candidate key that you choose to identify each row uniquely is called the primary key. In the table Vehicle, if you choose Serial# to identify rows uniquely is called the primary key.
Alternate Key:
A Candidate key that is not chosen as a primary key is an alternate key. In the table Vehicle, if you choose SErial# as the Primary key, Regn# is the Alternate key.
It is important that you understand that a primary key is the only sure way to identify the rows of a table. Hence, an alternate key may have the value NULL. A NULL value is not to be permitted in the primary key since it would be difficult to uniquely identify rows containing NULL values.
Hope this helps.
Edited by vbsqluser - 06 June 2013 at 6:43am