Secondary Key is the key that has not been selected to be the primary key. However, it is considered a candidate key for the primary key.
Therefore, a candidate key not selected as a primary key is called secondary key. Candidate key is an attribute or set of attributes that you can consider as a Primary key.
Note: Secondary Key is not a Foreign 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 key. Rest of the two keys would be Secondary Key.
Let’s say you selected Student_ID as primary key, therefore Student_Enroll and Student_Email will be Secondary Key (candidates of primary key).
Let us see another example −
Above, Employee_ID, Employee_No and Employee_Email are the candidate keys. They uniquely identify the Employee record. Select any one of the candidate key as the primary key. Rest of the two keys would be Secondary Key.