Re: remove gaps in a table

From: Jerry Stuckle <jstucklex_at_attglobal.net>
Date: Wed, 20 Dec 2017 18:04:16 -0500
Message-ID: <p1eq9e$i8o$1_at_jstuckle.eternal-september.org>


On 12/20/2017 2:27 PM, J�rgen Exner wrote:
> On Wed, 20 Dec 2017 19:20:09 +0100, "J.O. Aho" <user_at_example.net> wrote
> in comp.databases.mysql:
>> For you if you want completely gapless order numbers, don't delete, when
>
> ACK. Mark the order as "deleted" but never remove it from the DB. That
> is the correct way to go.
>
>> an order is "deleted", you generate a new order which is the complete
>> opposite of the original order, so if the original order is for 3 nails
>> of a value of 3 dollars, then the new one is for -3 nails for the value
>> of -3 dollars. This way you have gapless order numbers for the
>> accounting department and the numbers would be correct from an
>> accounting point of view.
>
> That is nuts. How would e.g. shipping package and send -3 nails?
>

That is the way it is done in a good accounting system (especially double entry). Never delete or change a record once it has been entered - reverse it. It keeps the books in balance and the inventory correct.

> That reminds me of a hack in some really large company where there was
> some very special item (a very special screw or washer or something like
> that). It was so leight-weight, that the ordering system refused to
> accept the weight. On the other hand it was needed only in very small
> quantities, so making the smallest shipping unit a box of 100 or 1000
> was out of the question, too.
> The hack was to enter the actual weight multiplied by 10000 into the DB
> to make the DB happy. No problem, everyone involved knew about the
> deception, it was working fine for some time.
> That is until someone did order a larger quantity. The shipping system
> detected the heavy weight, ordered a semi truck specifically for this
> shipment, and the truck driver had a good laugh when the whole cargo in
> his 18-wheeler was a single 3.5kg box instead of the expected 35 tons.
>
> jue
> .
>

This was a problem with the system not accepting the correct weight. A completely different process than reversing a transaction.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex_at_attglobal.net
==================
Received on Thu Dec 21 2017 - 00:04:16 CET

Original text of this message