mysql - Insert new row with id 1 -


is there possibility delete entire data in table , insert new rows id starts 1

delete command helps remove data table when trying insert new row id last inserted row id+1(if last inserted id 5 new id should 6) want store id 1

any suggestions other truncate command, in advance

after deleteing records do

alter table tablename auto_increment = 1 

note

from mysql docs : link

you cannot reset counter value less or equal have been used. myisam, if value less or equal maximum value in auto_increment column, value reset current maximum plus one. innodb, if value less current maximum value in column, no error occurs , current sequence value not changed.


Comments

Popular posts from this blog

c# - SelectList with Dictionary, add values to the Dictionary after it's assigned to SelectList -

mysqli - Php Mysqli_fetch_assoc Error : "Warning: Illegal string offset 'name' in" -

javascript - Chart.js - setting tooltip z-index -