| [Relational Theory] | [Carol's HomePage] |
![]()
![]()
| Primary Keys | 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 Keys 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 relational database design, a unique key or primary key is a candidate key to uniquely identify each row in a table. A unique key or primary key comprises a single column or set of columns. No two distinct rows in a table can have the same value (or combination of values) in those columns. Depending on its design, a table may have arbitrarily many unique keys but at most one primary key.
![]()
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:
1 primary key n-1 alternate keys n candidate keys
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://leven.cis.utas.edu.au/users/cae/my_websites/theory/PrimaryKeys.shtml
Last modified: 13 November 2007 16:20:09 EST |