
- DBMS Tutorial
- DBMS - Home
- DBMS - Overview
- DBMS - Architecture
- DBMS - Data Models
- DBMS - Data Schemas
- DBMS - Data Independence
- Entity Relationship Model
- DBMS - ER Model Basic Concepts
- DBMS - ER Diagram Representation
- DBMS - Generalization, Aggregation
- Relational Model
- DBMS - Codd's Rules
- DBMS - Relational Data Model
- DBMS - Relational Algebra
- DBMS - ER to Relational Model
- DBMS- SQL Overview
- Relational Database Design
- DBMS - Database Normalization
- DBMS - Database Joins
- Storage and File Structure
- DBMS - Storage System
- DBMS - File Structure
- Indexing and Hashing
- DBMS - Indexing
- DBMS - Hashing
- Transaction And Concurrency
- DBMS - Transaction
- DBMS - Concurrency Control
- DBMS - Deadlock
- Backup and Recovery
- DBMS - Data Backup
- DBMS - Data Recovery
- DBMS Useful Resources
- DBMS - Quick Guide
- DBMS - Useful Resources
- DBMS - Discussion
Alternate Key in RDBMS
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 −
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 |
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 −
<Employee>
Employee_ID | Employee_SSN | Employee_Name | Employee_Phone |
E897 | SSN08 | Harry | 999999 |
E856 | SSN06 | Jacob | 999899 |
E871 | SSN09 | Amy | 999898 |
In the above table, the following are the three candidate keys −
Employee_ID Employee_SSN Employee_Phone |
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.
- Related Articles
- Composite Key in RDBMS
- Secondary Key in RDBMS
- Super Key in RDBMS
- Surrogate Key in RDBMS
- Candidate Key in RDBMS
- Foreign Key in RDBMS
- Unique Key in RDBMS
- Python Program to Alternate list elements as key-value pairs
- What is the definition and usage of alternate key in a DB2 table?
- RDBMS terminologies
- Referential Integrity Rule in RDBMS
- Entity Integrity Rule in RDBMS
- Future of RDBMS
- Difference between RDBMS and OODBMS
- Difference between DBMS and RDBMS
