Insert after truncate start from 1; but insert after delete resumes from previous value

后端 未结 3 1262
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-28 09:07

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

3条回答
  •  不知归路
    2021-01-28 09:18

    you give AUTO INCREMENT in id that's why it is behave like this.whenever you truncate its reset the identity while in case of delete operation its start from last value of your id. if don't want this behavior remove AUTO INCREMENT index from id field.

提交回复
热议问题