Making an exiting column primary key
- vardhman0000
- Jul 16, 2021
- 1 min read
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 !!
Comentarios