Reputation: 25
i'm deleting previous data and trying to insert new list of data,id values are keep on increment because of auto-increment. is it possible to have new auto increment id with 1 ?
and i tried with ALTER TABLE table AUTO_INCREMENT = 1;
its not working for me.
Upvotes: 2
Views: 2348
Reputation: 909
Use this query while deleting your old 20 Records.
truncate table YourTableName;
It will reset the database structure and if you insert new record it will start from 1(one) id again.
Upvotes: 2
Reputation: 612
You cannot reset the counter to a value less than or equal to the value that is currently in use. For both
InnoDB
andMyISAM
, if the value is less than or equal to the maximum value currently in the AUTO_INCREMENT column, the value is reset to the current maximumAUTO_INCREMENT
column value plus one.
And also read this article Link
Just visit this question
Upvotes: 0