top of page

Making an exiting column primary key

Command for making an existing column a Primary Key in MySQL


Some existing Tables :
ree

Initial description of table test :
desc test;
ree

Here, there is no Primary Key yet.


Here we will make ID column as Primary key using Alter command :
ALTER TABLE TEST ADD PRMARY KEY(ID);
ree

Final Result :
DESC TEST;
ree

Here ID column is now Primary key !!

Comentarios


bottom of page