Re: Separate PK in Jxn Tbl?
Date: Sat, 26 Jan 2008 21:09:57 -0500
Message-ID: <#y9kCoIYIHA.5164_at_TK2MSFTNGP03.phx.gbl>
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 :-). Is the AutoNumber primary key a denormalization of the schema? Yes. Is it added for a reason? Yes again. I'm still waiting for a cogent reason for me to go to using natural keys.
James A. Fortune
MPAPoster_at_FortuneJames.com
Received on Sun Jan 27 2008 - 03:09:57 CET
