Select Page

DBMS keys, Concepts of Super Key, Candidate Key, Primary Key

In a relational database management system (RDBMS), a key is a field or set of fields that uniquely identifies each record in a table. Keys are essential to the proper functioning of a database, as they ensure that each record can be uniquely identified and accessed.

There are three main types of keys in an RDBMS: super keys, candidate keys, and primary keys.

Super Key: A super key is a set of one or more fields in a table that can be used to uniquely identify each record in the table. A super key may contain more fields than are required to uniquely identify a record, and it may include fields that are not unique.

Candidate Key: A candidate key is a set of one or more fields in a table that can uniquely identify each record in the table, and that has the minimum number of fields required to achieve this. Each candidate key is a potential candidate for the primary key of the table.

Primary Key: A primary key is a candidate key that has been chosen as the main key for a table. The primary key must be unique for each record in the table, and it must not contain any null values. The primary key is used as a reference by other tables that have relationships with the table, and it is often used to enforce referential integrity constraints.

In summary, a key is a field or set of fields that uniquely identifies each record in a table, and there are three main types of keys in an RDBMS: super keys, candidate keys, and primary keys. Super keys and candidate keys are used to identify potential primary keys, while the primary key is the chosen key for a table that is used to ensure referential integrity and to establish relationships with other tables.