tags:

views:

55

answers:

3

I have a primary key name idnumber. how can I remove its primary key in mysql

A: 

This should work for you, but are you sure you want to drop the primary key?


ALTER TABLE tablename DROP PRIMARY KEY;

Troggy
A: 

Help on alter table syntax here

Why would you want to drop the the primary key? If you created it by mistake then you can change it by

alter table T drop primary key, add primary key (C);

Where T is the table name and C is the column containing the correct primary key

Chris McCauley
A: 

You'd need to drop and create a new primary key if you currently have it on AUTOINCREMENT, something like this:

ALTER TABLE table DROP PRIMARY KEY, ADD PRIMARY KEY(your_column);
Yaraher