Using the ALTER statement: Step 1.- DROP the primary key Step 2.- ADD the new primary key
Adolfo > -----Original Message----- > From: Alliax [mailto:[EMAIL PROTECTED]] > Sent: Saturday, December 14, 2002 9:54 AM > To: Adolfo Bello; [EMAIL PROTECTED] > Subject: RE: BEGINNER: in mysql, better to do 1 table for one > relationship, even with a one to one relation ? > > > Hello, you're right, creating the table with 2 primary keys > works fine. What I was doing is try to convert my personID > and carID fields into primary, and it says: > > Error MySQL : > Invalid SQL: ALTER TABLE `varmalinalliax`.`tgl_rel_rest_card` > CHANGE `restID` `restID` INT (11) DEFAULT '0' NOT NULL , > CHANGE `cardID` `cardID` INT (11) DEFAULT '0' NOT NULL , ADD > PRIMARY KEY(`restID`), ADD PRIMARY KEY(`cardID`) Error My SQL > number: 1068 (Multiple primary key defined) > > What simple query could I make to transform the fields in > primary ? I don't have access to the mysql server via command > line, I use a php package (eSKUeL, it's like phpMyAdmin) > > Cheers, > Damien COLA > > > -----Message d'origine----- > > Could you post your create table statement? > > > > It should be something like: > > > > CREATE TABLE relation_person_car( > > personID int 11 NOT NULL, > > carID int 11 NOT NULL, > > PRIMARY KEY (personID,carID) > > ); > > > > --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php