|
Re: Difference between Primary key and Unique¬null on a col [message #375246 is a reply to message #375245] |
Wed, 08 August 2001 12:16 |
andrew again
Messages: 2577 Registered: March 2000
|
Senior Member |
|
|
there are 3 alternatives to consider:
1.) Primary key - consists of a constraint of type 'P'=primary and a unique index.
2.) Unique constraint - consists of a constraint of type 'U'=unique and a unique index.
3.) Unique index.
in 1 & 2 you can disable the constraint in which case the unique index gets dropped, but the constraint remains (in a DISBALED state). When you re-enable the constraint, the index is re-created. 1 always has NOT NULL as a requirement, 2 does not. 1 corresponds to a requirement from relational theory. A table can only have one PK, but could have several Unique constraints. Stick to 1 for primary keys.
|
|
|