How do you look for a delete ID number that has been used, but deleted as is no longer used, before you just append on top of the last ID number that has been added
For example:
ID Name
1 Orange
5 Apple
I have auto increment on, I want to add Banana in to number 2, but auto increment is adding it as ID 6
It’s just how auto-inc works.
If you are running MySQL, I think it has something built-in which does this for you, but I could be wrong since I can’t find it in the documentation.
You can also write a script yourself. It’ll be a pretty intense script on both the web server and the database server so it shouldn’t be ran too often.
Auto-inc has worked the same for years. It’s obviously doing something right. Unless you have a particular reason for not wanting gaps in your primary keys (and even then, you should seriously reconsider what you’re using the field for), just let it be. If the field is int 10 and unsigned, you will have plenty of wiggle room…