sql
Reset AUTO_INCREMENT Column value MySql
ALTER TABLE tableName AUTO_INCREMENT=1
/*You can replace value 1 to your value
From where you want to start auto increment */
Sometimes it is required to reset a column value that has AUTO_INCREMENT after deleting some rows from a table. You can use this code snippet to reset the index of the auto_increment applied column. Here we are resetting the index to 1 but you can replace it with your value from where you want to start the next index.
Was this helpful?
Similar Posts