Skip to main content

Posts

Showing posts with the label The Crazy Programmer 7 Different Types of Keys in DBMS 7 Different Types of Keys in DBMS The Crazy Programmer

7 Different Types of Keys in DBMS Jitendra Ajmera The Crazy Programmer

The key is unique for every lock. Similarly, those attributes which are unique for every entity in a single table, are known as key attributes. Keys are nothing else only the unique attributes associated with every entity. Keys are useful in dbms for various reasons such as data integrity, efficient data retrieval, data consistency, data sorting, and many more. Let’s have a look at the different types of keys available in DBMS. Candidate Key Those attributes which may be unique for an entity can be considered as Candidate keys. Like ID, name, mobile number, and address in the above table. Primary Key From candidate keys, we choose a key that is almost unique for every entity, called the Primary key for that entity and the whole table. Name, address, and mobile number may be not unique, but the ID number will be unique for every entity, so we choose the ID number as a primary key. The primary keys should be easy to find, and allocate, and not be much complex. Mobile numbers are