Re: Surrogate Keys As Part Of Composite Keys?
Date: 2000/03/27
Message-ID: <38DFCA18.26F1128_at_rtp.ericsson.com>#1/1
Thomas Muller wrote:
> [...]
> First of all, "surrogate key" is not a common term within RDB terminology.
Perhaps not, but Date uses the term in his book, and my brother, who is a database expert at Coca-Cola (Atlanta, GA) was familiar with the term as well.
> I
> think you mean candidate key.
> A table may have several candidate keys (a key
> being a single/composite field(s) uniquely identifying a row), and you
> choose one of them as the primary key (PM).
>
> I don't fully understand the question, but regarding the order <-> orderline
> relation, there's no need for a single field serving as candidate key,
> simply because this field wouldn't carry any useful information. The proper
> way to model the order/order_line relation is like this:
>
> order(order_id, date, ....)
> order_line(order_id, line#, article#, ...) // PM = (order_id, line#), line#
> ranges from 1...infinite for each order_id)
You haven't answered my question. My question is: why *not* do it with a surrogate key? I've known for a week and agree that the method above is the proper way to model the table, but I'm missing the theory and corresponding insight on *why* I need to do it this way.
-- Randy Yates DSP Engineer Ericsson / Research Triangle Park, NC, USA qusraya_at_rtp.ericsson.se, 919-472-1124Received on Mon Mar 27 2000 - 00:00:00 CEST