Delete, Truncate or Drop to clean out a table in MySQL

前端 未结 6 569
野性不改
野性不改 2021-02-07 03:49

I am attempting to clean out a table but not get rid of the actual structure of the table. I have an id column that is auto-incrementing; I don\'t need to keep the

6条回答
  •  死守一世寂寞
    2021-02-07 04:01

    TRUNCATE will reset your auto-increment seed (on InnoDB tables, at least), although you could note its value before truncating and re-set accordingly afterwards using alter table:

    ALTER TABLE t2 AUTO_INCREMENT = value
    

提交回复
热议问题