Re: Surrogate primary key plus unique constraint vs. natural primary key: data integrity?
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.
- Jan Hidders