List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:September 25 1999 3:59pm
Subject:Re: Multiple Primary Keys
View as plain text  
At 9:56 AM -0500 9/25/99, Yuval Malchi wrote:
>Hi,
>
>I have two tables with a many to many relationship and
>they need an associative table which uses the primary
>keys from both tables.  Mysql tells me that "multiple
>primary keys defined".  Is this not possible to do in
>Mysql?  How do I get around it?

Use two UNIQUE indexes.  A table can have only one PRIMARY
KEY, but multiple UNIQUE indexes.

But perhaps what you really want is a two-column PRIMARY
KEY, given your description.  It's somewhat ususual to
have multiple unique indexes on a table.

--
Paul DuBois, paul@stripped
Thread
Multiple Primary KeysYuval Malchi25 Sep
  • Re: Multiple Primary KeysPaul DuBois25 Sep
  • Re: Multiple Primary KeysBob Kline25 Sep
Re: Multiple Primary KeysYuval Malchi25 Sep
  • Re: Multiple Primary KeysPaul DuBois25 Sep
  • Re: Multiple Primary KeysPaul DuBois25 Sep
  • RE: Multiple Primary Keysbkline25 Sep
  • RE: Multiple Primary KeysOtis Gospodnetic25 Sep
    • RE: Multiple Primary KeysBob Kline25 Sep
Re: Multiple Primary KeysYuval Malchi25 Sep
RE: Multiple Primary KeysYuval Malchi25 Sep
  • RE: Multiple Primary KeysBob Kline25 Sep
  • Re: Multiple Primary KeysMartin Ramsch25 Sep