I
I
im_dimas2016-01-24 18:40:05
PHP
im_dimas, 2016-01-24 18:40:05

How to order the ID field by AUTO_INCREMENT?

I don't know what went wrong, but now the value of the ID field is very huge (11111462)

Отображение строк 0 - 24 (18027 всего, Запрос занял 0.0014 сек.) [ID: 11111461 - 11111437

It is required to overwrite the values ​​of all ID fields in ascending order, so that it starts at 0 and ends at 18027.
Like this: all accounts are 18027, so that the countdown is from the number 18027. I don’t know how else to explain

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
soface, 2016-01-24
@soface

Don't worry, the maximum value of int = 2147483647, you are still very far from this number.

P
profesor08, 2016-01-24
@profesor08

Accounts are added, deleted, added, deleted, but after deletion, the counter should not be reset, it continues to tick. That's the way it should be. That's when it exceeds two billion, then it will be necessary to worry and urgently change the type of the column from int to bigint, and forget it.
But of course there is another option that will suit you, but here you will need to abandon AUTO_INCREMENT, and write your own trigger, or whatever, so that when adding a new record, a free ID is set in the ID field.

W
WarGot, 2016-01-24
@WarGot

If I understand correctly, you want this
ALTER TABLE `table` AUTO_INCREMENT = 18027;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question