What is the candidate key in DBMS?

What is Candidate Key in DBMS?

Candidate Key in DBMS is a minimal set of columns/attributes that can be used to uniquely identify a single/every tuple or row in a relation.

Candidate Keys are determined during database design based on the underlying business rules of the database.

After finding all possible candidate keys in a relation.DBA chooses one key as a primary key.

Consider the following relation in the context of a business firm:

candidate key
candidate key

 Employee(EmpNo, Name, AadharNo, Salary, DOB)

Let us try to identify some candidate keys for this relation

KeyDescription
EmpnoThis seems to be a good candidate key as companies usually issue a unique no for each employee.
AdharnoThis seems to be a good candidate key for a company that is based in India.
Name, DOBThis might work for a small organization of 5 to 10 people as a combination of name and DOB is unique.
SalaryThis is not a good candidate key as salary is paid uniformly to people at the same level.
Empno, DOBIt is not a candidate key as empno alone is unique. Because only a minimal set of an attribute can be candidate key.

For other interesting technical blog Articles click here

Candidate key vs Primary key-

 There are a few differences between the candidate key and the primary key. In a table, it may be there is more than one candidate key exist.

But in a table, only one primary key can exist. The primary key is also a candidate key but the only difference is one of the candidate key work as a primary key.

Conclusion-

Show the main purpose of this key is to identify the rows uniquely. it means any column or combination of a column that is minimal and by which we can uniquely identify the rows.

Now you can easily understand the concept of a candidate key.

If you have any problem on the database management system then comment your questions

Thank you

Leave a Comment