Wednesday, April 11, 2007

Difference between Primary Key and Unique Key

A primary key is a special case of unique keys. The major difference is that for unique keys the implicit NOT NULL constraint is not automatically enforced, while for primary keys it is. Thus, the values in a unique key columns may or may not be NULL.

Point to Remember :

Cannot set primary key constraint to a nullable column.
Cannot drop a column when it has the primary key constraint.
A table cannot have more than one primary key.

No comments: