List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:July 31 2000 3:15am
Subject:RE: The meaning of "UNIQUE idx_user_id (user_id)"
View as plain text  
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
Thread
The meaning of "UNIQUE idx_user_id (user_id)"henrydesiato30 Jul
  • Re: The meaning of "UNIQUE idx_user_id (user_id)"Paul DuBois30 Jul
    • RE: The meaning of "UNIQUE idx_user_id (user_id)"henrydesiato30 Jul
      • RE: The meaning of "UNIQUE idx_user_id (user_id)"indrek siitan30 Jul
        • RE: The meaning of "UNIQUE idx_user_id (user_id)"henrydesiato31 Jul
          • RE: The meaning of "UNIQUE idx_user_id (user_id)"indrek siitan31 Jul
  • Re: The meaning of "UNIQUE idx_user_id (user_id)"Paul DuBois30 Jul
  • RE: The meaning of "UNIQUE idx_user_id (user_id)"indrek siitan30 Jul
    • RE: The meaning of "UNIQUE idx_user_id (user_id)"henrydesiato31 Jul
Re: The meaning of "UNIQUE idx_user_id (user_id)"Nick Lindridge30 Jul
  • RE: The meaning of "UNIQUE idx_user_id (user_id)"henrydesiato30 Jul
Re: The meaning of "UNIQUE idx_user_id (user_id)"Nick Lindridge31 Jul
  • RE: The meaning of "UNIQUE idx_user_id (user_id)"henrydesiato31 Jul
    • RE: The meaning of "UNIQUE idx_user_id (user_id)"Paul DuBois31 Jul
      • RE: The meaning of "UNIQUE idx_user_id (user_id)"henrydesiato31 Jul
        • Re: The meaning of "UNIQUE idx_user_id (user_id)"Benjamin Pflugmann31 Jul
        • RE: The meaning of "UNIQUE idx_user_id (user_id)"Paul DuBois31 Jul
    • Re: The meaning of "UNIQUE idx_user_id (user_id)"Benjamin Pflugmann31 Jul
Re: The meaning of "UNIQUE idx_user_id (user_id)"Nick Lindridge31 Jul
  • RE: The meaning of "UNIQUE idx_user_id (user_id)"henrydesiato31 Jul
RE: The meaning of "UNIQUE idx_user_id (user_id)"henrydesiato31 Jul
  • RE: The meaning of "UNIQUE idx_user_id (user_id)"Paul DuBois31 Jul
Re: The meaning of "UNIQUE idx_user_id (user_id)"Nick Lindridge31 Jul
  • RE: The meaning of "UNIQUE idx_user_id (user_id)"henrydesiato31 Jul
    • RE: The meaning of "UNIQUE idx_user_id (user_id)"Paul DuBois31 Jul
    • Re: The meaning of "UNIQUE idx_user_id (user_id)"Mike Wexler31 Jul
      • Re: The meaning of "UNIQUE idx_user_id (user_id)"Paul DuBois31 Jul