Home > other >  how to remove record permanantely from mysql database
how to remove record permanantely from mysql database

Time:12-18

I have been working on a spring boot and react project with MySQL as my main DB when ever I perform DELETE operation on ID = 1 from the client or react it deletes the record fields like the firstName, lastName, email but the ID is still there so when I POST new record instead of assigning the deleted id it increments by 1 (ID = 2) I don't know why is this happening? can anyone help thanks

CodePudding user response:

This is because of AutoIncrement. AutoIncrement never uses deleted id again because it could be a bad idea in many cases. For instance, You have millions of records and you delete something from the beginning, the database has to shift all of the data 1 id backward which is not a good idea.

  • Related