I have a table with the column name id and the settings of both PRIMARY KEY and AUTO INCREMENT. When a row is deleted mid-way through the table, i.e. row 29 in rows 1 – 70, id 29 will simply disappear. Is it possible to have it so that the rows shift up, but the id remains there, i.e. deleting 70 instead of 29, so that the row that had id 30 will now adopt 29, 31 will adopt 30 etc?
This will make it a lot easier when inserting new data into the table in my case if this is possible.
I’m really looking to have the values used up before a new one is created, so it’s either this which would be great, or looking for missing values and updating them.
UPDATE:
I wanted this to say, get the row above a certain row, and if all the id columns were in straight value order (no gaps) then I’d be able to do it relatively easily.
answer to the edited question
Previous ID:
Next ID: