List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:July 30 2000 10:35pm
Subject:Re: The meaning of "UNIQUE idx_user_id (user_id)"
View as plain text  
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
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