Re: Newbie question

From: Jon Heggland <heggland_at_idi.ntnu.no>
Date: Tue, 21 Jun 2005 10:39:12 +0200
Message-ID: <MPG.1d21f0864ff3b4439896a9_at_news.ntnu.no>


In article <knndb1dp1sihupert9ik3ohu13rgsge885_at_4ax.com>, alfredo_novoa_at_hotmail.com says...
> >Off the top of my head, the main
> >advantages of surrogate keys vs. natural keys are that they are stable
> >(I.e. they don't change),
>
> Why is this an advantage?

Cheap answer: Because Oracle doesn't support ON UPDATE CASCADE. :)

> But most natural keys don't change.
>
> > and they are never unknown.
>
> Most natural keys are never unknown.

It's hard to disagree with qualified statements like that, but as long as some natural keys may be unknown or inapplicable or whatever, surrogate keys have a use.

> >Anyway, many "real-world" keys are really surrogates---SSNs, account
> >numbers, registration numbers, student numbers and so on.
>
> And that is a reason for not creating new surrogates.

I'm not saying you should exclusively use surrogates and never natural keys. My point was simply "primary key != natural key"---or to elaborate: A primary key may be a natural key and vice versa, but not necessarily. And that surrogates are definitely "acceptable", and often/sometimes (YMMV) useful.

-- 
Jon
Received on Tue Jun 21 2005 - 10:39:12 CEST

Original text of this message