List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:December 28 2004 9:36pm
Subject:Re: unique key <-> primary key
View as plain text  
At 22:27 +0100 12/28/04, Martijn Tonies wrote:
>Hello,
>
>>  I have two tables, seemigly very similar setup; the primary key is the
>>  combination of two columns. With mysqldump, however, the table
>>  definition of the two tables looks different.
>>
>>  Mysqldump on table 1 says
>>      ...
>>      UNIQUE KEY HONstid (HONstid,HONname)
>>  whereas on table 2 it says
>>      ...
>>      PRIMARY KEY  (IMstid,IMfnum)
>>
>>  What is the difference? Is there any?
>
>A table can have only 1 primary key, but multiple unique constraints.

And columns in primary keys must be NOT NULL.  Columns in unique
keys can be NULL (if they are NOT NULL, then the unique key is
functionally the same as a primary key).

-- 
Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA
MySQL AB, www.mysql.com
Thread
unique key <-> primary keyGaspar Bakos28 Dec
  • Re: unique key <-> primary keyMartijn Tonies28 Dec
    • Re: unique key <-> primary keyPaul DuBois28 Dec
      • Re: unique key <-> primary keyGaspar Bakos28 Dec
  • Re: unique key <-> primary keyMartijn Tonies29 Dec
  • Re: unique key <-> primary keyMartijn Tonies29 Dec