| [Relational Theory] | [Carol's HomePage] |
![]()
![]()
| Primary Key | An attribute or group of attributes used to uniquely identify the tuples of a relation. |
A subset (often one) of the attributes is chosen as the primary key, that is, an identifier of rows. No two rows will have the same value of this key.
| Primary key | The candidate key that is selected to identify tuples uniquely within the relation. |
The primary key is a unique identifier of the table - that is, a column or column combination with the property that, at any given time, no two rows of the table contain the same value in that column or column combination.
For any relation (table) one candidate key will be selected as the primary key.
It is common to designate one of the candidate keys as the primary key of the relation. This is the candidate key which is used to identify tuples in the relation.
If a relation has several keys, they are referred to as candidate keys. However, one key is often designated as the primary key.
| Primary key | A candidate key selected to uniquely identify all other attributes in any given row. Cannot contain null entries. |
A primary key is a single field or combination of fields that uniquely defines a record. None of the fields that are part of the primary key can contain a null value. A table can have only one primary key.
Note: In Oracle, a primary key can not contain more than 32 columns.
A primary key can be defined in either a CREATE TABLE statement or an ALTER TABLE statement.
Primary key refers to an attribute or attributes that uniquely identify one and only one occurrence of an entity.
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.
![]()
A primary key is a special case of a candidate key.
A primary key does not stop being a candidate key when it is selected as the primary key.
If I have n candidate keys, and I chose one to be the primary key, I then have:
Alternate keys are candidate keys not chosen as primary keys.
![]()
There is an important difference between a primary key having more than one attribute (possible) and a relation having more than one primary key (impossible).
![]()
A primary key is selected so that we can make sure that each tuple (row) has some unique identifier. The attributes which form the primary key are not allowed to have no value at all. (No value is called a null value.) Primary key values are used to cross-reference tuples (rows) in one relation (table) with tuples in another in order to represent the relationship between the objects about which the data represents information.
![]()
|
URL: http://computer/%7ECarol.Edmondson/theory/PrimaryKeys.shtml
Last modified: 21 November 2006 13:39:45 EST |