make an ID in a mysql table auto_increment (after the fact)

前端 未结 7 1443
隐瞒了意图╮
隐瞒了意图╮ 2020-11-30 20:09

I acquired a database from another developer. He didn\'t use auto_incrementers on any tables. They all have primary key ID\'s, but he did all the incrementing manually, in

相关标签:
7条回答
  • 2020-11-30 20:39

    Yes, easy. Just run a data-definition query to update the tables, adding an AUTO_INCREMENT column.

    If you have an existing database, be careful to preserve any foreign-key relationships that might already be there on the "artificially created" primary keys.

    0 讨论(0)
提交回复
热议问题