Answer the question
In order to leave comments, you need to log in
Why is the last id not assigned when deleting a value?
In general, such a question. There is a table. It has an auto-added id field. Why, for example, when deleting the last value from the table, and adding a new one, a new id is assigned, and not the id of the deleted element. And is there any way to fix this?
Answer the question
In order to leave comments, you need to log in
You can fix it, but you don't need to . Because it will greatly affect performance.
With a 32-bit id there will be two billion values, with a 64-bit one - a number with 18 zeros at the end.
1) This question is more about SQL, not Qt, and certainly not about C ++
2) Most likely, the table has auto-increment, look at the identifier settings for the ID column.
But you should disable auto-increment only for reference tables that will not be updated, And the big question is why.
1. jcmvbkbc , right ─ a question about the database, in what language is the program written that accesses the database does not matter
2. indicate the database
3. you can fix it, but why?
given that qt is specified in the tags, I can assume that you are using sqlite (if my memory serves me in qt, you can use it out of the box, I can be wrong on c for a very long time), if so, when creating a table, simply do not write id integer primary key autoincrement and just id integer primary key
but first think about whether you really need it?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question