3 messages in com.mysql.lists.mysqlHow make column UNIQUE NOT NULL AUTO_...
FromSent OnAttachments
sam1...@iname.com13 Apr 1999 23:52 
Graham Ashton13 Apr 1999 23:59 
Paul DuBois14 Apr 1999 07:59 
Subject:How make column UNIQUE NOT NULL AUTO_INCREMENT?
From:sam1...@iname.com (sam1@iname.com)
Date:04/13/1999 11:52:05 PM
List:com.mysql.lists.mysql

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