how to remove composite key value from primary key in mysql -


i have table emp in mysql.i add primary key using constraint pk_id.i create table this.

`mysql> create table emp (p_id int(10) not null,name varchar(10),city varchar(10),constraint pk_id primary key(p_id,name)); 

now want remove name.i tried following query

mysql> alter table emp drop primary key(name); 

but not working.should possible remove single value primary key

you should dropy primary key , recreate

alter table emp drop primary key; alter table emp add primary key ((p_id); 

and if need id auto_incement

alter table emp modify column p_id int auto_increment; 

Comments