Re: remove gaps in a table

From: Axel Schwenke <axel.schwenke_at_gmx.de>
Date: Tue, 19 Dec 2017 22:45:12 +0100
Message-ID: <p1c198$o98$1_at_dont-email.me>


On 19.12.2017 22:03, mireero wrote:
...
> I'm looking for a way to "reduce" the order_number, to remove gaps
> How would you achieve this ?

short answer: I wouldn't.

long(er) answer: why should I? The exact value in an `id` column doesn't matter. The only thing that counts, is that the number is unique within it's context. Gaps do not interfere with that goal. Hence: no need to remove or fill gaps.

If you need something like a running number for certain records you pull from the database - create it on the fly. There is no point of actually *storing* it in the database. If you want to know in which order the orders in a certain period arrived - just order them by the auto-increment PK. A running number within that period does not add any information to your data. Received on Tue Dec 19 2017 - 22:45:12 CET

Original text of this message