Note:-Before running this query Data( Records ) must & should empty then it will work. if Data ( Records ) is available so this method doesn't
work .This Query should not work for InnoDB.
Truncate Table :- Truncate table automatically reset the Auto increment values to 0.
TRUNCATE TABLE table_name;
Drop & Recreate Table :- This is another way of resetting auto increment index.
Note:-dnt use this method
SET @num := 0;
UPDATE Tablename SET id = @num := (@num+1);
ALTER TABLE Tablename AUTO_INCREMENT =1;
OR
ALTER TABLE Tablename DROP fieldname
ALTER TABLE Tablename ADD fieldname int(10) NOT NULL AUTO_INCREMENT ,ADD PRIMARY KEY (field name)