How to reset the autoincrement field in Mysql data base?
Asked
Active
Viewed 1,003 times
1 Answers
0
You can reset the auto-increment column by using the following command:
ALTER TABLE table_name AUTO_INCREMENT = 10;
You can retrieve the most recent automatically generated AUTO_INCREMENT value with the LAST_INSERT_ID() SQL function.
If you wish to set auto-increment value to be 1, you can also truncate the table data.
TRUNCATE TABLE table_name;
I hope this answer will help you. Thanks.
Rathish Kumar B
- 2,320
- 5
- 24
- 36