List:General Discussion« Previous MessageNext Message »
From:Mark V Date:October 20 2003 6:07pm
Subject:Re: Newbie - Primary Keys
View as plain text  
Hi Carlos,

You can't have 2 primary keys. A table can only have
one primary key. You can, however, also define a
Unique key, and if you set it up such that it is not
null, it will act much like a prmary key:

CREATE TABLE test 
(  id1 INT UNSIGNED NOT NULL, 
   PRIMARY KEY (id1), 
   id2 INT UNSIGNED NOT NULL, 
   UNIQUE KEY (id2), 
   data VARCHAR(25)
);

Hope that helps,
Mark

--- Carlos Vazquez <Carlos@stripped> wrote:
> Hi all!
>  
> Just wanted to know how do I create a table with two
> primary keys.
>  
> Thanks a lot!
>  
> 


__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com
Thread
Newbie - Primary KeysCarlos Vazquez20 Oct
  • Re: Newbie - Primary KeysMark V20 Oct
Re: Newbie - Primary KeysMark V20 Oct
Re: Newbie - Primary KeysMark V20 Oct
RE: Newbie - Primary KeysCarlos Vazquez20 Oct