Re: Surrogate primary key plus unique constraint vs. natural primary key: data integrity?

From: Jan Hidders <hidders_at_gmail.com>
Date: Tue, 12 Mar 2013 12:22:38 -0700 (PDT)
Message-ID: <b8fd5fb6-e874-43f7-bd42-d523ba6ea2f4_at_googlegroups.com>


Op dinsdag 12 maart 2013 17:54:12 UTC+1 schreef rob..._at_gmail.com het volgende:
> On Monday, March 11, 2013 11:38:50 PM UTC+2, Jan Hidders wrote:
>
> > deliveries {id, delivery_no, client-id, order-id, location-id}
> >
> > key {id}
> > key {delivery_no}
> > fk (client-id, order-id) -> client_orders(client-id, order-id)
> > fk (client-id, location-id) -> client_locations(client-id, location-id)
> >
> > I'm not saying it's pretty, just possible. ;-)
>
>
> Well, would be simpler to add foreign keys to superkeys, this would solve the problem (I actually use this technique in practice to simplify constraint implementations). But let's not forget that the main argument of surrogate keys supporters is the elimination of composite foreign keys.

Is it? I'm agnostic on the issue myself, and I would never use that exact argument. Rather I would claim that in general the approach tends to reduce their number, which is true.

  • Jan Hidders
Received on Tue Mar 12 2013 - 20:22:38 CET

Original text of this message