List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:May 1 1999 10:48pm
Subject:UNIQUE as column constraint?
View as plain text  
>>>>> "Tkil" == Tkil  <tkil@stripped> writes:

Tkil> First off, thanks for the great work on MySQL.  I'm just now learning
Tkil> SQL, and it's great to have a robust, free implementation to learn on.

Tkil> I'm using Martin Gruber's book _Understanding SQL_ as a basic
Tkil> reference (along with mysql.info).  The book indicates that UNIQUE
Tkil> should be available as a column constraint:

Tkil> | CREATE TABLE Foo (
Tkil> |	bar INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, # ok so far
Tkil> |	baz INTEGER NOT NULL UNIQUE # MySQL doesn't like "UNIQUE" here.
Tkil> | );

Tkil> It's easy enough to work around; remove UNIQUE from the 'baz'
Tkil> definition above, and add

Tkil> |	UNIQUE (baz)

Tkil> to the table defintion.

Tkil> It seems like it would be easy enough to add to MySQL, since it
Tkil> already supports PRIMARY KEY.  Or am I missing something blindingly
Tkil> obvious?  Since I'm a beginner, I wouldn't be surprised.  :)

Hi!

I just added this to the upcoming 3.23 version.

Regards,
Monty
Thread
UNIQUE as column constraint?Tkil1 May
  • UNIQUE as column constraint?Michael Widenius2 May
    • Re: UNIQUE as column constraint?Tkil3 May