I created a table and set a field to auto increment some thing like this:
CREATE TABLE t1(id BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT) ENGINE = MyISAM AUTO_INCREMENT = 123456;
But to some reason i deleted some of the rows in the table.
Now the question is when i insert new rows in the table the new rows should be assigned id’s of the rows which have been deleted rather than assigning new id’s.
I do not want to reset all the id’s
How can i do this??
Help appreciated:)
Sorry to say, but that is not the use of
AUTO_INCREMENT.If you want to re-use id’s, then you would have to write your own trigger functions, and doing this is generally considered bad practice.Imagine you were on id 50,000, and deleted an entry with id 1… would you really want the next record you add to re-use id 1?