I have a table with structure
Table-a Id was primary key
ID | Name
1 | Gourav
2 | Amit
3 | Rahul
But After that primary key automatically removed by restoring database to other database..
Now Records in Table are
ID | Name
1 | Gourav
2 | Amit
3 | Rahul
0 | AAA
0 | BBB
0 | CCC
How can i add primary key to id column again and can handle the existing data as well in MYSQL.
Thanks in advance..
Add PK as AUTO_INCREMENT, it will change all 0 values automatically –
After, AUTO_INCREMENT property can be removed –