Unique key
In database relational database modeling and implementation, a unique key is a set of zero, one or more attributes.
Description
The value(s) of these attributes are required to be unique for each tuple (row) in a relation. The value, or combination of values, of unique key attributes for any tuple may not be repeated for any other tuple in that relation.
When more than one column is combined to form a unique key, their combined value is used to access each row and maintain uniqueness. These keys are referred to as aggregate or compound keys. Values are not combined, they are compared using their data types.
When a column or set of columns is defined as unique to the database management system, the system verifies that each set of value(s) is unique before assigning the constraint. After the column(s) are defined as unique, an error will occur if an insertion is attempted with values that already exist.
Some systems will not allow key values to be updated, all systems will not allow duplicates. This ensures that uniqueness is maintained in both the primary table and any relations that are later bound to it.
See also
- Attribute (computing)
- Compound key
- Database
- Data model
- Globally Unique Identifier
- Natural key
- Persistent Object Identifier
- Relational model
- Tuple
- Uniqueness quantification
External links
- Unique key @ Wikipedia