At 3:10 PM -0700 2000-07-30, henrydesiato@stripped wrote:
>Hi,
>
>I thought I understood what UNIQUE did until I ran across this piece of
>code:
>
>CREATE TABLE users (
> user_id int(32) unsigned NOT NULL DEFAULT '0' auto_increment,
> user_name varchar(16) NOT NULL,
> password varchar(16) NOT NULL,
> PRIMARY KEY (user_id),
> UNIQUE idx_user_id (user_id),
> KEY (user_name),
> UNIQUE idx_user_name (user_name)
>);
>
>
>Is idx_user_id another column? What would it contain? What would its storage
>requirement be? Or is it an alias for user_id? Either way, why would one
>want to write this line of code? What purpose would it achieve?
To answer your other questions, and perhaps more a propos to what you
may really be wondering: idx_user_id is pointless. There is already
a PRIMARY KEY on the user_id column, and a PRIMARY KEY is a unique
index. Hence, there is no use for the idx_user_id index.
--
Paul DuBois, paul@stripped