change auto_increment within same table using subquery mysql

后端 未结 4 1162
青春惊慌失措
青春惊慌失措 2021-01-14 15:56

I am using mysql. I have a database table with auto_increment counter set. Now because of a requirement I need to leave starting 100 ids free and move all existing records s

4条回答
  •  伪装坚强ぢ
    2021-01-14 16:22

    According to the maual (http://dev.mysql.com/doc/refman/5.5/en/example-auto-increment.html) the auto_increment value will automatically adjust, when you insert or alter a value in the auto_increment filed manually.

    So after giving your records the new id = id+100 you need not care about the auto_increment value anymore...

提交回复
热议问题