List:General Discussion« Previous MessageNext Message »
From:Gaspar Bakos Date:December 28 2004 7:48pm
Subject:unique key <-> primary key
View as plain text  
Hi,

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?

Table1:
mysql> desc table1;
...
    | HONstid | int(3)    |      | PRI | 1        |       |
    | HONname | char(20)  |      | PRI | standard |       |
...

Table2:
mysql> desc table2;
...
    | IMstid      | int(3)       |      | PRI | 0                   |       |
    | IMfnum      | int(6)       |      | PRI | 0                   |       |
...

A general question: is there a difference between a "primary key" and a
"unique key", or they are synonims?

Cheers
Gaspar
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