In my table there is column name id which is auto increment integer. When I truncate table and then try to perform insert query it starts from 1, but if I do delete operation an
The current max value for the autoincrement function is stored in the table definition (you can see it when you run show create table idle
.
When you delete all rows from the table, the autoincrement value will stay the same. When you truncate the table you basically drop the table and recreate it, which resets the the autoincrement value to 0.
Hope this helps.