Primary key

In the relational model of databases, a primary key is a designated attribute (column) that can reliably identify and distinguish between each individual record in a table. The database creator can choose an existing unique attribute or combination of attributes from the table (a natural key) to act as its primary key, or create a new attribute containing a unique ID that exists solely for this purpose (a surrogate key).

Examples of natural keys that could be suitable primary keys include data that is already by definition unique to all items in the table such as a national identification number attribute for person records, or the combination of a very precise timestamp attribute with a very precise location attribute for event records.

More formally, a primary key is a specific choice of a minimal set of attributes that uniquely specify a tuple (row) in a relation (table).[a][1] A primary key is a choice[clarification needed] of a candidate key (a minimal superkey); any other candidate key is an alternate key.


Cite error: There are <ref group=lower-alpha> tags or {{efn}} templates on this page, but the references will not show without a {{reflist|group=lower-alpha}} template or {{notelist}} template (see the help page).

  1. ^ "Add or change a table's primary key in Access". Microsoft. Retrieved January 20, 2020. A primary key is a field or set of fields with values that are unique throughout a table.

Developed by StudentB