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?
>
>I've poured all over MySQL's online documentation for an answer but to no
>avail... In fact, I have another question: Is there a definitive source
>where there's detailed info about SQL statements, clauses, subclauses etc?
>MySQL site is nice but it's far from being thorough.
http://www.mysql.com/documentation/mysql/commented/manual.php3?section=CREATE_TABLE
UNIQUE creates a unique index. In the case above, idx_user_id is the
name of the index, and user_id is the column that is indexed.
I'm not sure what you mean about the MySQL site not being thorough.
The printed manual is about 500 pages long, and the online version
contains the same information.
--
Paul DuBois, paul@stripped