Reorder ID column

Anyone know of an easy way to reorder an PRIMARY auto increment column that has lots of holes in it?


Yes, you don’t!
That’s the purpose of the primary key to hold unique keys.

What is your reason to do this, it looks messy or?
Unless you have a very good reason to do it you generally leave it as it is.

Agree with the above post, and if you reordered a relational table setup the relation ships would have to reflect the changes.

If there are no relationships to be lost, then you could just CREATE TABLE LIKE… called table_new

Then do INSERT INTO table_new (id, column1 …) SELECT null, column1 … FROM table_old;

LOL. That’s a great point.

Upon further reflection I’m going to leave it as it is.

I was looking around and found a link to a way to get random values even when you have gaps so that’ll work just fine for me.

And, mostly, this was just a case of “cuz it looks ‘bad’” )