Jump to content

Changing a NOT NULL table to NULL


eMonk

Recommended Posts

How can I remove the primary key for city_id?

 

I tried to remove it in phpmyadmin but got this error:

 

Error

SQL query:

 

ALTER TABLE  `model_in_city` DROP PRIMARY KEY ,

ADD PRIMARY KEY (  `model_id` )

 

MySQL said:

 

#1062 - Duplicate entry '17' for key 1

if the table can have more than one row with the same model_id, then model_id can not be the primary key by itself. The primary key, whether it be one column or more, has to be able to be used to uniquely identify any one row in the table.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.