Re: Separate PK in Jxn Tbl?

From: Bob Badour <bbadour_at_pei.sympatico.ca>
Date: Sat, 26 Jan 2008 23:16:49 -0400
Message-ID: <479bf7ac$0$4056$9a566e8b_at_news.aliant.net>


James A. Fortune wrote:

> Marshall wrote:
>

>> On Jan 26, 4:26 am, "David Cressey" <cresse..._at_verizon.net> wrote:
>>
>>> When you want to delete an entry form a junction table,  you almost 
>>> always
>>> know the two FKs that uniquely determine the entry to be deleted.  You
>>> almost never know the value of the superflous surrogate key.  So it's 
>>> simple
>>> to use the two FK's as the criterion for deletion than it is to look 
>>> up the
>>> ID field,  and then use that as the basis for deletion.
>>
>> Yes, exactly.
>>
>> One of the greatest benefits, and one of the fundamental
>> differences between how SQL treats data and how
>> (most) conventional programming languages treat data
>> is that in SQL we specify data by its value, instead of by
>> location. I often observe that superfluous keys in the field
>> are an attempt to make SQL data have an address, to
>> make it behave the way the programmer's mental model
>> (perhaps influenced by years of using pointers) does.
>>
>> Marshall

>
> Personally, I don't take the natural keys out either, so they can still
> be used for the deletion. The thought of giving the SQL data an address
> and following a programmer's mental model did not enter into my thinking
> at all. I am not trying to give the data an order either. You've been
> listening to Celko too much. Because of his overall manner, which I
> find quite offensive, I don't even want to listen to him when he's right
> :-).

So, you object to Celko's style but consider him right?!? That's a new one. ::rolls eyes::

   Is the AutoNumber primary key a denormalization of the schema?
> Yes.

You are an ignoramus. You don't even have a clue what normalization is. The addition of an attribute to act as a simple, stable key does not affect the normal form in any way shape or manner.

   Is it added for a reason? Yes again. I'm still waiting for a
> cogent reason for me to go to using natural keys.

It's the familiarity, stupid. The design criteria for keys are (and I repeat): uniqueness, irreducibility, stability, simplicity and familiarity (in no particular order.) Received on Sun Jan 27 2008 - 04:16:49 CET

Original text of this message