Terminology Related to Primary Key
When it comes to primary keys, there are several related terminologies you may come across as follows:
- Primary Key: A primary key is a type of key that contains a column or set of columns in a table that uniquely identifies each row in the table. The primary key is an attribute or a set of attributes that help to uniquely identify the tuples(records) in the relational table.
- Candidate Key: A candidate key is any attribute or combination of attributes that uniquely identifies rows in the table and the attribute that forms the key can not be further reduced.
- Composite Key: A composite key is a primary key that consists of two or more columns in a database table. It is used when a single column cannot uniquely identify a record, but the combination of multiple columns can.
- Surrogate Key: A manufactured unique identifier created in each database table record. When a natural primary key is not available, this value, which is usually an integer or a system-generated number, is utilized.
- Foreign Key: A foreign key is an attribute of a relationship or group of attributes that could serve as the primary key of another relationship to which it is connected through a relationship.
- Referential Integrity: Reference Consistency A database constraint known as referential integrity ensures that relationships between tables are correct and consistent. A foreign key in one table must match a primary key value in another table, or it must be NULL, according to this rule.
- Unique Key: The primary key in which value can not be duplicated in any of the rows or tuples of the Relation table. Although similar to a primary key, a unique key does not necessarily serve as the primary identifier for the table.
- Natural Key: A natural key is a column or a set of columns in a database table that has inherent meaning and can uniquely identify a record. It is derived from the data itself and is not an artificially generated value.
Primary Key in DBMS
In DBMS there are different types of keys available that are used for various purposes, for which the most common key is known as a primary key. A primary key is a unique identifier assigned to each record within a database table.