Alternate Key or Secondary Key is the key that has not been selected to be the primary key, but are candidate keys. However, it is considered a candidate key for the primary key.
A candidate key not selected as a primary key is called alternate or secondary key. Candidate key is an attribute or set of attributes that you can consider as a Primary key.
Let us see an example −
Above, Student_ID, Student_Enroll and Student_Email are the candidate keys. They are considered candidate keys since they can uniquely identify the student record. Select any one of the candidate key as the primary. Rest of the two keys would be Alternate or Secondary Key.
Let’s say you selected Student_ID as primary key, therefore Student_Enroll and Student_Email will be Alternate Key (candidates of primary key).
Let us see another example −
In the above table, the following are the three candidate keys −
Select any one of the above key as Primary Key, for example, EmployeeSSN. The rest of the two keys would then be called Alternate Keys because they were candidates of Primary Key.
Therefore, Employee_SSN and Employee_Phone are Alternate Keys.