I have database table but without the index, and I want to add index id
to that table, that will be uniqe for each row, how can I do this using mysql?
Assuming you don't have a key on the table already you can do this:
ALTER TABLE whatever ADD id Int NOT NULL AUTO_INCREMENT PRIMARY KEY;
And remember you can add FIRST
to the end of that line to make it the first column which would be a good idea for an id.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With