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

html - Cut text on left side inside button while centering -

plugins - CodeIgniter support on netbeans 8.0 -

php - Selecting items from MySQL for a status update feed efficiently while accounting for possible spam -