On Wed, 24 Oct 2007 09:43:10 +0200
Nis Jørgensen <nis@superlativ.dk> wrote:
> Well, I have a couple of times had the "need" to have a primary
> key/uniqueness constraint with one column nullable (indicating "Not
> Applicable"). The "problem" is that we have only one NULL, which for
> comparison purposes is interpreted as "Not Known".
Of course. Happens all the time. However, UNIQUE and PRIMARY are not
the same thing. PRIMARY implies that the column uniquely and
definitively identifies the row. If you have NULLs in the column than
it does not meet the criteria. Here are the rules for primary key
taken from http://articles.techrepublic.com.com/5100-22-1045050.html.
- The primary key must uniquely identify each record.- A record?s primary-key value can?t be null.- The primary
key-valuemust exist when the record is created.- The primary key must remain stable?you can?t change the primary-key
field(s).- The primary key must be compact and contain the fewest possible attributes. - The primary-key value can?t be
changed.
--
D'Arcy J.M. Cain <darcy@druid.net> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.