Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Primary key
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Relational databases concept}} {{one source|date=June 2021}} In the [[relational model]] of [[database]]s, a '''primary key''' is a designated attribute ([[Column (database)|column]]) that can reliably identify and distinguish between each individual record in a [[Table (database)|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 identifier|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 <em>specific choice</em> of a <em>minimal</em> set of attributes that uniquely specify a tuple ([[Row (database)|row]]) in a [[Relation (database)|relation]] (table).{{efn|Corresponding terms are respectively theoretical (attribute, tuple, relation) and concrete (column, row, table).}}<ref>{{cite web |url=https://support.office.com/en-us/article/add-or-change-a-table-s-primary-key-in-access-07b4a84b-0063-4d56-8b00-65f2975e4379 |title=Add or change a table's primary key in Access |publisher=Microsoft |access-date=January 20, 2020 |quote=A primary key is a field or set of fields with values that are unique throughout a table.}}</ref> A primary key is a choice{{clarify|date=August 2024}} of a [[candidate key]] (a minimal [[superkey]]); any other candidate key is an '''alternate key'''.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)