[Users] Question about one tables's layout

Klaus Darilion klaus.mailinglists at pernau.at
Tue Oct 11 18:43:44 CEST 2005


Juan Carlos Castro y Castro wrote:
> Why UNIQUE KEY? Wouldn't PRIMARY KEY be better?
> 
> CREATE TABLE dbaliases (
>  alias_username varchar(64) default '' NOT NULL,
>  alias_domain varchar(128) default '' NOT NULL,
>  username varchar(64) default '' NOT NULL,
>  domain varchar(128) default '' NOT NULL,
>  UNIQUE KEY alias_key (alias_username,alias_domain),
>  INDEX alias_user (username, domain)
> );
> 
...
   Unique Key     Column(s) value(s) must be unique in table or null (see
                  note below)

   Primary Key    UK + Not Null which equates to every column in the key
                  must have a value and this value is unique so the PK
                  uniquely identifies each and every row in the table
...


Thus I suggest you are right.

regards
klaus

> 
> _______________________________________________
> Users mailing list
> Users at openser.org
> http://openser.org/cgi-bin/mailman/listinfo/users
> 
> 





More information about the Users mailing list