List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:October 17 1999 11:10am
Subject:Re: Unique
View as plain text  
>>>>> "Bob" == Bob Kline <bkline@stripped> writes:

Bob> On Fri, 15 Oct 1999, Benjamin Pflugmann wrote:
>> 
>> Just curious: I don't see why one would like to have the ability to
>> have NULL with a unique column. You can get only one record with NULL
>> value in. I had never a use for this.

Bob> I believe some DBMS implementations (Oracle is one which comes to mind)
Bob> allow multiple rows with NULL in a column with a UNIQUE constraint.  I
Bob> guess the idea (which isn't so outlandish, though a tad sloppier than
Bob> the purists would like) is to have a compromise placeholder which allows
Bob> rows to be stored before the unique value has been selected, but still
Bob> enforces uniqueness on the non-NULL values.  It's certainly cleaner and
Bob> easier to track and manage than 'TEMP001', 'TEMP002' (which gets even
Bob> worse for numeric columns, where you have to rope off a range of numbers
Bob> as 'invalid for permanent values').

MySQL 3.23 allows multiple NULL values in a column with an UNIQUE
constraint.  This is ok as NULL != NULL in SQL.

Regards,
Monty
Thread
UniqueAnders J√∂felt14 Oct
  • Re: UniqueBenjamin Pflugmann15 Oct
    • Re: UniqueBob Kline15 Oct
      • Re: UniqueMichael Widenius17 Oct
  • Re: UniquePaul DuBois15 Oct
  • Re: UniqueGerald Clark15 Oct