Alternate Key หรือ Secondary Key คือคีย์ที่ไม่ได้ถูกเลือกเป็น Primary Key แต่เป็น Candidate Keys
Candidate Key ที่ไม่ได้ถูกเลือกเป็น Primary Key เรียกว่า Alternate Key หรือ Secondary Key Candidate Key คือแอตทริบิวต์หรือชุดแอตทริบิวต์ที่สามารถพิจารณาเป็น Primary Key ได้
ตัวอย่างที่ 1
| 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 และ Student_Email เป็น Candidate Keys เลือกหนึ่งเป็น Primary Key ที่เหลือเป็น Alternate/Secondary Key
สมมติเลือก Student_ID เป็น Primary Key ดังนั้น Student_Enroll และ Student_Email จะเป็น Alternate Keys
ตัวอย่างที่ 2
<Employee>
| Employee_ID | Employee_SSN | Employee_Name | Employee_Phone |
| E897 | SSN08 | Harry | 999999 |
| E856 | SSN06 | Jacob | 999899 |
| E871 | SSN09 | Amy | 999898 |
Candidate Keys ทั้ง 3:
| Employee_ID Employee_SSN Employee_Phone |
เลือก Employee_SSN เป็น Primary Key ที่เหลือ Employee_ID และ Employee_Phone เป็น Alternate Keys
สรุป
- Alternate Key = Secondary Key = Candidate Key ที่ไม่ได้เป็น Primary Key
- ใช้สำหรับ unique constraints และ indexing ทางเลือก
- ไม่ใช่ Foreign Key