In database design, a primary key is a value that can be used to look up a particular row in a table. Attributes are associated with it. Examples are names in a telephone book (to look up telephone numbers), words in a dictionary (to look up definitions), and Dewey Decimal Numbers (to look up books in a library).
In the relational model of data, a primary key is a candidate key chosen as the main method of uniquely identifying a tuple in a relation. Practical telephone books, dictionaries and libraries can not use names, words or Dewey Decimal System numbers as candidate keys because they do not uniquely identify telephone numbers, word definitions or books.
In some design situations it is impossible to find a natural key that uniquely identifies a tuple in a relation. A surrogate key can be used as the primary key. In other situations there may be more than one candidate key for a relation, and no candidate key is obviously preferred. A surrogate key may be used as the primary key to avoid giving one candidate key artificial primacy over the others.
See also