0

So I added a column in the table for the numbering. I would like to go through all the rows in the table and number them from 1 onwards. How would you go about doing this?

John Conde
  • 217,595
  • 99
  • 455
  • 496
Fake Name
  • 119
  • 1
  • 7

1 Answers1

2

Just use AUTO_INCREMENT. It will automatically update your existing rows and all future rows.

ALTER TABLE tablename CHANGE id id INT(10) AUTO_INCREMENT PRIMARY KEY;
John Conde
  • 217,595
  • 99
  • 455
  • 496