top of page

Making an exiting column primary key

Command for making an existing column a Primary Key in MySQL


Some existing Tables :

Initial description of table test :
desc test;

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);

Final Result :
DESC TEST;

Here ID column is now Primary key !!

Comments


bottom of page