So my database's primary key is just a column called 'id'
. When i go to add a new item into the database I want it in a specific order without having to go into the DB and changing every value after it to +1
whatever it was before.
Example:
ID
| 1 | item1 |
| 2 | item2 |
| 3 | item3 |
| 4 | item4 |
Say I want to add an item inbetween
item2 and item3. To do that I would need to change item 3's id to 4 and item4's id to 5, but currently I have to go into the database and do it automatically.
How would I make it increment automatically when I INSERT a new item?