-2

I am currently working on a personal project and i would like to be able to delete SQL and not have autoincrement still go from the last id it was

Jackson F.
  • 15
  • 4

1 Answers1

0

This is probably worth an answer.

delete from t

and

truncate table t

are very similar in that they both remove all rows from the the table t. However, truncate table has certain other features, such as:

  • No logging, so it is faster.
  • Resetting the auto-increment value.
  • No invocation of triggers.

So, use it to empty your tables and remove all the rows.

The documentation discusses this.

Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786