List:General Discussion« Previous MessageNext Message »
From:Tkil Date:May 1 1999 9:23am
Subject:UNIQUE as column constraint?
View as plain text  
First off, thanks for the great work on MySQL.  I'm just now learning
SQL, and it's great to have a robust, free implementation to learn on.

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

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

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

|	UNIQUE (baz)

to the table defintion.

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

Thanks again,
t.
Thread
UNIQUE as column constraint?Tkil1 May
  • UNIQUE as column constraint?Michael Widenius2 May
    • Re: UNIQUE as column constraint?Tkil3 May