As we have seen in the candidate key guide that a table can have multiple candidate keys. Among these candidate keys, only one key gets selected as primary key, the remaining keys are known as alternative or secondary keys.
Alternate Key Example
Lets take an example to understand the alternate key concept. Here we have a table Employee, this table has three attributes: Emp_Id, Emp_Number & Emp_Name.
Table: Employee/strong>
Emp_Id Emp_Number Emp_Name ------ ---------- -------- E01 2264 Steve E22 2278 Ajeet E23 2288 Chaitanya E45 2290 Robert
There are two candidate keys in the above table:
{Emp_Id}
{Emp_Number}
DBA (Database administrator) can choose any of the above key as primary key. Lets say Emp_Id is chosen as primary key.
Since we have selected Emp_Id
as primary key, the remaining key Emp_Number
would be called alternative or secondary key.
Leave a Reply