Alternate Key in DBMS
Alternate Key
In this article, we will learn about Alternate Key in DBMS.
Alternate keys are columns present in the table which are not selected as primary keys but still, they have all the capabilities to be used as a primary key is called alternate keys.
Examples for an alternate key
Example if a table student contain four columns
[ID,NAME,PHONE,AGE ]
Consider the following table student
ID | NAME | PHONE | AGE |
---|---|---|---|
66 | John | 7832973477 | 23 |
67 | Judy | 9732867464 | 21 |
68 | Elena | 8923826476 | 25 |
69 | John | 7326247844 | 23 |
- Among these four columns ID is used as a primary key because no two students will have the same Id and capable of uniquely accessing a student record in the table
- In the same way phone attribute, no two students will have same phone number.Hence phone column is an alternate key because it is not been selected as a primary key, even if it is having the capability to be selected as a primary key
Prime Course Trailer
Related Banners
Get PrepInsta Prime & get Access to all 200+ courses offered by PrepInsta in One Subscription
Get over 200+ course One Subscription
Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others
Login/Signup to comment