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

From: <robur.6_at_gmail.com>
Date: Tue, 12 Mar 2013 09:54:12 -0700 (PDT)
Message-ID: <28dcc252-1221-4a84-85ba-ccbf5fba673c_at_googlegroups.com>


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. Received on Tue Mar 12 2013 - 17:54:12 CET

Original text of this message