Alternate Key in RDBMS

An Alternate Key (also called Secondary Key) is a candidate key that was not selected as the primary key. Every table may have multiple candidate keys that can uniquely identify each row, but only one is chosen as the primary key. The remaining candidate keys become alternate keys.

Example 1: Student Table

Consider the following Student table ?

Student_ID Student_Enroll Student_Name Student_Email
096 2717 Manish aaa@gmail.com
055 2655 Manan abc@gmail.com
067 2699 Shreyas pqr@gmail.com

Student_ID, Student_Enroll, and Student_Email are the candidate keys since each can uniquely identify a student record. If we select Student_ID as the primary key, then the remaining two become alternate keys ?

Candidate Keys:  Student_ID, Student_Enroll, Student_Email

Primary Key:     Student_ID
Alternate Keys:  Student_Enroll, Student_Email

Example 2: Employee Table

Employee_ID Employee_SSN Employee_Name Employee_Phone
E897 SSN08 Harry 999999
E856 SSN06 Jacob 999899
E871 SSN09 Amy 999898

The candidate keys are Employee_ID, Employee_SSN, and Employee_Phone. If we select Employee_ID as the primary key, then Employee_SSN and Employee_Phone become alternate keys.

Candidate Keys:  Employee_ID, Employee_SSN, Employee_Phone

Primary Key:     Employee_ID
Alternate Keys:  Employee_SSN, Employee_Phone

Conclusion

Alternate keys are candidate keys that were not chosen as the primary key. They can still be used to uniquely identify rows and are often defined with UNIQUE constraints in SQL to enforce their uniqueness in the database.

Updated on: 2026-03-14T20:08:48+05:30

5K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements