The behavior of auto increment number in MySQL is keep increasing even the existing record had been removed. For example, let say your auto increment had reach 10, and you delete the record of 9, 10. The next record inserted is will still be 11.
Sometime you will just want it to be continue with 9 instead of 11. It can be done with an ALTER TABLE statement:
ALTER TABLE tablename AUTO_INCREMENT = 1;
No comments:
Post a Comment