Hi, I've been testing my data offline and now want to reset the id orders to post on my host. I have ID's that looks pretty random. (1,2,3,7,10,18,32) How do I change all the ID numbers so it'll consist of 1,2,3,4,5,6,7?
This question comes up occasionally, the answer is usually, "don't bother". Most applications treat the id as an internal key, so a few gaps don't matter.
You can drop the table, recreate it, and reinsert the data if you really want to. But the gaps will probably creep back over time.
depeding on how your database tables are related to one another, reordering keys could cause alot of parternerships to break down as well. Gaps are inevitable on any table that can update and delete rows. Unless you have a physical need to keep them in order, at which point you would need to either create a stored procedure to re-auto the entire table on an interval or trigger like "delete from" but it's a real hassle especially if your dealing with large number of rows