Text Size: Normal / Large This page in other versions:
Unsupported versions: 6.4 / 6.5  Chapter 12. Indices and Keys
Author: Written by Herouth Maoz  Editor's Note: This originally
appeared on the mailing list in response to the question: "What
is the difference between PRIMARY KEY and UNIQUE constraints?".
What's the difference between:                PRIMARY
KEY(fields,...) and               UNIQUE (fields,...)         -
Is this an alias?        - If PRIMARY KEY is already unique,
then why          is there another kind of key named UNIQUE?  A
primary key is the field(s) used to identify a specific row. For
example, Social Security numbers identifying a person.  A simply
UNIQUE combination of fields has nothing to do with identifying
the row. It's simply an integrity constraint. For example, I
have collections of links. Each collection is identified by a
unique number, which is the primary key. This key is used in
relations.  However, my application requires that each
collection will also have a