Re: remove gaps in a table

From: Gordon Burditt <gordonb.44sq6_at_burditt.org>
Date: Wed, 20 Dec 2017 05:07:42 -0600
Message-ID: <qbSdnYla_a_j2afHnZ2dnUU7-XPNnZ2d_at_posted.internetamerica>


> - order_id is unique
> - order_number is unique for a given month and start back at 1 every month.
> - there are gaps in the order_id sequence, for example, in october, we
> have 4 orders with order_number: 1, 2, 3, 5.
> In november, we have 6 orders with order_number: 1, 2, 4, 9, 10.
>
>
> I'm looking for a way to "reduce" the order_number, to remove gaps, that
> is to obtain:

[Quoted] It seems to me that the point of an order_id is so the customer and your company can use it to refer to a specific order in communications between them. In this case, every time you change an order_id, you have to inform the customer. Customers won't put up with that for very long.

If you think about it, it gets even worse with bank account numbers where you have transactions in transit with bank account numbers on them, and the consequences of having a transaction get attached to the wrong account are much more serious.

It's not at all uncommon for a change in a database to have or need real-world consequences. Received on Wed Dec 20 2017 - 12:07:42 CET

Original text of this message