Unique key

From Wikipedia, the free encyclopedia

In database design, a unique key refers to the attribute which is unique for that column of the table. No two distinct rows in a table can have the same fields in the unique key field.

A unique key can also be used as a primary key, i.e., it is a subset of the composite key. A primary key or candidate key should always be unique, but the vice-versa is not true. This doesnot mean that unique key should always be a primary key. A unique key does not enforce the not null constraint, i.e., a unique may or may not be null.