I have a column in a MySQL table which enters an auto-increment ID as new rows are added. Data from the MySQL table is pulled into an HTML table and the rows of the HTML table are sorted by the ID column. Normally this works fine for my purposes, but I now need to enter a row with a lower ID than the current auto-increment value, so that it appears further down the table.
So, I am wondering if there is a way, using a MySQL statement to add 1 to the ID values for a specific range of rows, e.g. add 1 to rows 800-850, so that they would now be 801-851, and then I could manually insert a new row with an ID value of 800.
You need to let the
auto-incrementationworking alone and create a new fieldtable_idin your table to set theidnumber you want.Reset table
idis never a good idea : for example, don’t forget all foreign keys linked on your tableid.To increment 1 to your specific
idnumber, it would be :