Insert new row with id 1

mysql, sql

Solution

After deleteing all records do

ALTER TABLE tablename AUTO_INCREMENT = 1

Note

From MySQL Docs : Link

You cannot reset the counter to a value less than or equal to any that have already been used. For MyISAM, if the value is less than or equal to the maximum value currently in the AUTO_INCREMENT column, the value is reset to the current maximum plus one. For InnoDB, if the value is less than the current maximum value in the column, no error occurs and the current sequence value is not changed.

Problem

Is there any possibility to delete the entire Data in table and insert new rows with id starts from 1 Delete Command helps to remove the data from table when we trying to insert new row that id will be Last inserted row id+1(if last inserted id is 5 then new id should be 6) but i want to store that id as 1 any suggestions other than truncate command, Thanks in advance

Original source