List:General Discussion« Previous MessageNext Message »
From:sam1600 Date:April 14 1999 6:52am
Subject:How make column UNIQUE NOT NULL AUTO_INCREMENT?
View as plain text  
Hello,
Ive been asking a lot of questions and I would
like to say thanks a lot for all your responses.

----------

My first question is, how in Mysql do I make a column
UNIQUE NOT NULL AUTO_INCREMENT
and at the same time add an index on it?

I tried:

CREATE TABLE table_name (
	column_name int(255) UNIQUE NOT NULL AUTO_INCREMENT ,
	KEY column_Inxname (column_name)
)

Mysql does not like the UNIQUE in there.

If I take the UNIQUE out of the declaration it works
but -phpMyAdmin- reports the Column and it's key as
NOT UNIQUE
... But if I use phpMyAdmin to declare another index on the column it reports that the new
( second ) key is
unique but the table dump shows no difference in the 
two Key declarations.

So my second question is, what do I want UNIQUE, the
key or the coulmn?  and why can't I get the first key
to be declared UNIQUE... not that i'm sure I want it
to be... I thought I wanted the column (unique auto
incrementing and not null)?

Thanks,
-Sam



----------------------------------------------------------------
Get your free email from AltaVista at http://altavista.iname.com
Thread
How make column UNIQUE NOT NULL AUTO_INCREMENT?sam160014 Apr
  • Re: How make column UNIQUE NOT NULL AUTO_INCREMENT?Graham Ashton14 Apr
  • Re: How make column UNIQUE NOT NULL AUTO_INCREMENT?Paul DuBois14 Apr