P
P
Pret12019-06-15 21:46:44
Python
Pret1, 2019-06-15 21:46:44

How to make table row id start from 1 even after deleting several rows?

I had a problem that when deleting rows from a table, the id order is violated, how to solve this so that when a row is deleted, the id order is not violated and always starts from 1

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
Ivan Yakushenko, 2019-06-15
@Prit1

No need to delete records, just replace the string with null, then there will be no problems in your case.

S
Sergey Gornostaev, 2019-06-15
@sergey-gornostaev

You don't have to do that. The whole point of identifiers is their immutability.

D
Dmitry Shitskov, 2019-06-15
@Zarom

the order of id was not violated

The order of id is not violated during autoincrement. Always goes in ascending order.
If you want to renumber rows, it will take a lot of resources to change the numbers of all records if any row is deleted. Yes, and what's the point?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question