Natural key

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

A natural key (also known as business key[1] or domain key[2]) is a type of unique key in a database formed of attributes that exist and are used in the external world outside the database (i.e. in the business domain or domain of discourse).[3] In the relational model of data, a natural key is a superkey and is therefore a functional determinant for all attributes in a relation.

A natural key serves two complementary purposes: it provides a means of identification for data and it imposes a rule, specifically a uniqueness constraint, to ensure that data remains unique within an information system. The uniqueness constraint assures uniqueness of data within a certain technical context (e.g. a set of values in a table, file or relation variable) by rejecting input of any data that would otherwise violate the constraint. This means that the user can rely on a guaranteed correspondence between facts identified by key values recorded in a system and the external domain of discourse (a single version of the truth).

A natural key differs from a surrogate key which has no meaning outside the database itself and is not based on real-world observation or intended as a statement about the reality being modelled. A natural key therefore provides a certain data quality guarantee whereas a surrogate does not. It is common for elements of data to have several keys, any number of which may be natural or surrogate.