[Database class] difference between "Primary Key" and "Unique"

Paul S. Wang pwang at cs.kent.edu
Wed Feb 23 16:59:45 EST 2011


Dear WDP II class,

There was a question about the difference between the 

PRIMARY KEY

and the

UNIQUE

constraints in MySQL.

The real difference is that a PRIMARY KEY can not be null.  A UNIQUE
field(s) can be NULL.   The UNIQUE constraint are only enforced on
non-NULL fields.

Paul


More information about the Dbclass mailing list