
- 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
Secondary Key in RDBMS
What is a Secondary Key
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.
Example
Let us see an example −
Student_ID | Student_Enroll | Student_Name | Student_Age | Student_Email |
096 | 9122717 | Manish | 25 | aaa@gmail.com |
055 | 9122655 | Manan | 23 | abc@gmail.com |
067 | 9122699 | Shreyas | 28 | 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 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).
Example
Let us see another example −
Employee_ID | Employee_No | Employee_Name | Employee_Email | Employee_Dept |
0989 | E7897 | Jacob | jacob@example.com | Finance |
0777 | E8768 | Anna | anna@example.com | HR |
0656 | E8789 | Tom | tom@example.com | Operations |
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.
- Related Articles
- Composite Key in RDBMS
- Super Key in RDBMS
- Surrogate Key in RDBMS
- Candidate Key in RDBMS
- Alternate Key in RDBMS
- Foreign Key in RDBMS
- Unique Key in RDBMS
- RDBMS terminologies
- Future of RDBMS
- Referential Integrity Rule in RDBMS
- Entity Integrity Rule in RDBMS
- Difference between RDBMS and OODBMS
- Difference between DBMS and RDBMS
- Difference between RDBMS and HBase
- Difference between RDBMS and MongoDB
