MySQL Forums :: Newbie :: table with multiple primary key


Advanced Search

table with multiple primary key
Posted by: Osmar Alvarez ()
Date: September 01, 2014 11:03PM

mysql> create table test (
-> id int auto_increment,
-> date date,
-> primary key (id,date) );
Query OK, 0 rows affected (0.00 sec)

Ok the above statement works, my question is when I try to do this:

mysql> alter table test add primary key (date);
ERROR 1068 (42000): Multiple primary key defined

Options: ReplyQuote


Subject Written By Posted
table with multiple primary key Osmar Alvarez 09/01/2014 11:03PM
Re: table with multiple primary key Peter Brawley 09/01/2014 11:23PM
Re: table with multiple primary key Rick James 09/02/2014 12:27AM
Re: table with multiple primary key Peter Brawley 09/02/2014 10:10AM
Re: table with multiple primary key Rick James 09/02/2014 07:14PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.