Re: pro- foreign key propaganda?

From: David Cressey <cressey73_at_verizon.net>
Date: Sun, 18 May 2008 10:15:13 GMT
Message-ID: <RkTXj.2139$Zy1.1952_at_trndny05>


"jonniesavell" <jsavell_at_gmail.com> wrote in message news:9e62cc4a-4e40-4cf5-9503-2bd77e0ddf46_at_x19g2000prg.googlegroups.com...
>
> > I think you are confusing foreign keys with declarative referential
> > integrity. Foreign keys are a must and I'm sure your database uses them.
> > What you are talking about (and I agree) is a constraint.
>
> OK. I am stupid. I thought that an instance of declarative referential
> integrity in DDL create a foreign key between one or two tables in the
> database.
>

Not stupid. Just ignorant. The wonderful thing about ignorance is that it can be cured. Read up on the subject, as others have suggested.

The above argument is about definitions.

> What's the difference?

If I say "select * from orders inner join order_detail

     on orders.order_no = order_detail.order_no;

then order_details.order_no must be a "foreign key" regardless of whether it was declared as such in DDL.

If in the above case, order_details.order_no is for some strange reason NOT a foreign_key reference to the corresponding row in orders, then you are the victim of a sadistic and perverse database designer. Or perhaps just a supremely ignorant one. Received on Sun May 18 2008 - 12:15:13 CEST

Original text of this message