At 6:21 PM -0700 2000-07-30, henrydesiato@stripped wrote:
>Hmm, according to your definition, the very first clause about CREATE TABLE
>in the manual:
>
>col_name type [NOT NULL | NULL] [DEFAULT default_value] [AUTO_INCREMENT]
>[PRIMARY KEY] [reference_definition]
>
>implies that all column names are also PRIMARY KEY since PRIMARY KEY is a
>keyword.
Not quite. In "UNIQUE [INDEX]", the presence or absence of INDEX doesn't
change the meaning because UNIQUE specifies an index already, so INDEX
is redundant.
In the syntax you've quoted above, neither "col_name" nor "type" imply anything
about whether the column is a PRIMARY KEY, so the presence or absence of
PRIMARY KEY is significant.
>-----Original Message-----
>
>
>> -----Original Message-----
>> Henry,
>>
>> I sometimes wonder if the MySQL manual is a limited edition and classed
>as
>> 'hard to find' :-)
>>
>> Anyway, here goes. The manual documents the index part of the CREATE
>>statement
>> as:
>>
>> "or UNIQUE [INDEX] [index_name] (index_col_name,...)"
>>
>> The items in [] are optional. This means that when you specify a unique
>>index,
>> the INDEX keyword is optional since it's implied by the use of UNIQUE,
>and
>>you
>> can also optionally specify a name for the index before the
>parenthesised
>> column list. You can probably figure out what 'idx_user_name' in your
>> example means now.
>>
>> Actually, I can't. Do you mean that index_name is a separate column or
>>just an alias for index_col_name? The manual does have a line for the
>syntax
>>of UNIQUE but it never explains it!
>>
>> Also, optional doesn't necessarily mean implied. In fact, are you sure
>>that UNIQUE implies INDEX?
>
>The [...] bracket notation means optional. INDEX is a keyword in this
>case, so UNIQUE and UNIQUE INDEX are exactly the same.
>
>--
>Paul DuBois, paul@stripped
--
Paul DuBois, paul@stripped