>Jeff has an understandable position, but perhaps oversimplified. The
Quote:
>issue is not just whether or not an auto ID can ever be shown to a
>user; it's also about data modeling strategy. The dichotomy is between
>domain (aka natural) keys and automatic keys, and the trade-offs are
>between user-friendliness and database efficiency.
Suppose you need to generate invoice numbers. You are replacing
an old system which involved pre-printed invoice forms with sequence
numbers put on them by the printer. How would you do it? It seems
an obvious application of an auto-increment field. And it seems a
waste to have an internal invoice id and an external invoice
identifier when there's no reason for two of them.
Incidentally, nobody tries to memorize invoice numbers: the company
issuing them looks them up on its computer, and the purchasing
company presumably doesn't have so many orders with this company
outstanding at once that looking for a piece of paper or looking
it up in THEIR accounts payable system is a problem.
Quote:
>For example, Acme Inc. is not Acme Int. so we could have company IDs
>based on their names. But what happens when Acme Inc. changes it's name
>to Acme & Sons?
This, I think, is one of the reasons why account numbers should not
be derived from names. Account numbers don't get married and change
their names even if the customers do. And there's no necessary
reason why an individual or a company can't have multiple accounts
(Some large companies have individual FedEx accounts for each region.
Lots of individuals have more than one account of the same type at
the same bank (e.g. this is the vacation account, this is the
downpayment on a house account, this is the retirement account,
....) And unless there is a security issue with being able to guess
account numbers (banks, credit card, etc.) I see no harm in assigning
them with an auto-increment field, which is no less insecure than
using a pad of pre-printed, pre-numbered forms.
Quote:
>We could stupidly call them Acme Inc. and ignore reality or change the
>ID to Acme & Sons. When we do that, we have to Update Cascade to all
>related records and rebuild indexes. Not hard to do, but it is a
>performance hit on a big system.
Yes, it hard to do, because you can't update paperwork in the hands
of the customer, nor paperwork taped onto packages in transit, nor
statements in the mail.
Quote:
>Plus, there is the risk that
>non-heterogeneous batches with the database don't get the Update
>Cascade, so the ID breaks in a batch job.
Quote:
>Some database designers would rather assign Acme Inc. a number and when
>they change to Acme & Sons, it's just an attribute change in the
>Company domain with no effect anywhere else in the system nor upon the
>non-heterogeneous batches.
It's not just *database designers*. Banks (and lots of other
companies) already had "account numbers" before the existence of
computers. They aren't artificial artifacts of the database
implementation, they are a key part of the business process. But
I'm saying you can use auto-increment to assign new Domain Keys as
well as AutoKeys.
Regardless of the number of name or address changes by the customer,
the account number stayed put, and the transactions to that account
didn't have to change because of it. But that didn't prevent them
from putting the account number on the billing statement so the
customer could read it over the phone to identify the account in
question.
Quote:
>The question remains: Should the user see the number? Sometmes No,
>Sometimes Yes. It depends upon the needs of the user and the workflow
>of the system.
Incidentally, there's no necessary reason why the account number
has to be used to log into a web-based ordering system used by the
customer, just because it's visible on a bill. They might have to
enter it once to set up a login for a purchasing agent, if it wasn't
set up when the account was created. Authorized purchasing agents
may come and go, but the account may last much longer.
Quote:
>Like Jeff, all database professional DO need to take a position on this
>and be consistent in your work. There is not necessarily one right
>answer. You can see the full extant of the debate on the original
>WardsWiki:
>
http://c2.com/cgi/wiki?AutoKeysVersusDomainKeys
>
>P.S. if you have never seen the Original Wiki, check it out:
>
http://c2.com/cgi/wiki
>
>-David Hedrick Skarjune
>
>Jeff North wrote:
Quote:
>On Sun, 12 Nov 2006 05:36:28 -0000, in mailing.database.mysql
>
gordonb.ace4j@burditt.org (Gordon Burditt)
><12ldcms76hh041c@corp.supernews.comwrote:
>>
Quote:
>| >Here in Australia we have a medical card with a serial number. I'd
>| >image most databases would use this number. Again it is not an
>| >auto-generated number.
>|
>| You mean a PLUMBER is going to ask for your medical card?
>>
>You've dishonestly snipped my explanation. The medical card number was
>just a further example.
>>
>If you wish to use auto-increment/numbers for inappropriate fields
>then that is your prerogative.
>>
>I use the simple rule that auto-increment/numbers are generated by the
>database and I shouldn't reply on/worry about the numbers.
>>
>[snip 2 end]
>---------------------------------------------------------------
>
jnorthau@yourpantsyahoo.com.au : Remove your pants to reply
>---------------------------------------------------------------
>