What if you have a large MYSQL table where you've used auto increment ID but your ID are not arrange as many of your row deleted. In this case if you want to arrange your ID like fresh one so that it may increase your MYSQL performance.
First create a blank duplicate table where no data exist. If new created table name "table1".
Your main table name is "table".
Now run this query
CREATE TEMPORARY TABLE tmp SELECT * FROM table;
UPDATE tmp SET id=NULL;
INSERT INTO table1 SELECT * FROM tmp;
DROP TABLE tmp;
You'll see the new "table1" table copied data from old table with arrange ID. now delete the old table.
That's it. Every easy haaa!!!!
First create a blank duplicate table where no data exist. If new created table name "table1".
Your main table name is "table".
Now run this query
CREATE TEMPORARY TABLE tmp SELECT * FROM table;
UPDATE tmp SET id=NULL;
INSERT INTO table1 SELECT * FROM tmp;
DROP TABLE tmp;
You'll see the new "table1" table copied data from old table with arrange ID. now delete the old table.
That's it. Every easy haaa!!!!