Re: Newbie question

From: Dan Guntermann <guntermann_at_verizon.net>
Date: Mon, 20 Jun 2005 08:50:45 GMT
Message-ID: <Frvte.22220$lb5.19402_at_trnddc04>


"Jon Heggland" <heggland_at_idi.ntnu.no> wrote in message news:MPG.1d2096e332422a4f9896a6_at_news.ntnu.no...
> In article <392dnQc1p91Yay_fRVnyhA_at_pipex.net>,
> specially_at_processed.almost.meat says...
> > > That is nonsense. Primary key != natural key.
> >
> > So a bogus counter that makes things trivially distinct is an acceptable
> > key? Explain. I am keen to understand. Be sure to explain what I
would be
> > identifying (not distinguishing) with such a thing. Also explain why I
> > wouldn't then just prefer a pointer instead.
>
> Yes, a bogus counter (or surrogate key, which is my preferred term) is
> an acceptable key. A key is simply a set of attributes so that no two
> tuples have identical values for those attributes.
>
> I'm not sure why you think surrogate keys are not acceptable---they are
> a staple of relational database design---but I'll assume you think they
> are useless in the presence of natural keys (which is the term for keys
> that come from the "real world"). Off the top of my head, the main
> advantages of surrogate keys vs. natural keys are that they are stable
> (I.e. they don't change), and they are never unknown. And of course:
> It's not always *possible* to find a reasonable natural key.

It wouldn't be C.D.T without the ol' surrogate argument swingin' around in its typical cyclic fashion. Personally, I think surrogate keys are as technically and theoretically valid as any key, but there are trade-offs and good practices to be considered. Some might find the following a good discourse on the subject, and some might not quite understand.

    "You are sad," the Knight said in an anxious tone: "let me sing you a song to comfort you."

    "Is it very long?" Alice asked, for she had heard a good deal of poetry that day.

    "It's long," said the Knight, "but it's very, very beautiful. Everybody that hears me sing it--either it brings the tears into the eyes, or else--"

    "Or else what?" said Alice, for the Knight had made a sudden pause.     "Or else it doesn't, you know. The name of the song is called 'Haddocks' Eyes.'"

    "Oh, that's the name of the song, is it?" Alice said, trying to feel interested.

    "No, you don't understand," the Knight said, looking a little vexed. "That's what the name is called. The name really is 'The Aged Aged Man.'"

    "Then I ought to have said, 'That's what the song is called'?" Alice corrected herself.

    "No, you oughtn't: that's quite another thing! The song is called 'Ways and Means': but that's only what it's called you know!"

    "Well, what is the song, then?" said Alice, who was by this time completely bewildered.

    "I was coming to that," the Knight said. "The song really is 'A-singing on a Gate': and the tune's my own invention."

    "So saying, he stopped his horse and let the reins fall on its neck: then, slowly beating time with one hand, and with a faint smile lighting up his gentle foolish face, as if he enjoyed the music of his song, he began. (Lewis Carroll, Through the Looking Glass, 1872).

[snip of the remaining very lucid and reasonable points]

> --
> Jon

Regards,

Daniel Guntermann Received on Mon Jun 20 2005 - 10:50:45 CEST

Original text of this message