Re: Primary Key Theory Question
Date: Sun, 28 Mar 2004 17:17:54 -0300
Em Sun, 28 Mar 2004 18:56:03 +0000, Ben escreveu:
> design work as 'properly' as possible. So, I've been reading through posts
> in this group for most of a day. While I wait for Celko's books to arrive,
> I thought I'd put a question to the gurus here.
> I've come to a conceptual impasse regarding primary keys. In doing my pen
> and paper design work and I've come up with two issues: Some of my
> entities can only be uniquely identified by all of their properties and
> some of my entities have good candidate keys, but in real life, that data
> might not be known.
The rule of thumb seems to be, use a natural key when it is practical to do so, say there is at least one composed by two or three field. Over that, use a surrogate key, but do keep the natural key(s) as well.
In fact every candidate key should be declared and enforced, the primary key distiction among candidate keys is pretty much arbitrary, needed because of practicality in SQL or general DB administration and usage, not because of conceptual considerations.
-- Leandro Guimarães Faria Corsetti Dutra +55 (11) 5685 2219 Av Sgto Geraldo Santana, 1100 6/71 +55 (11) 5686 9607 04.674-000 São Paulo, SP BRASIL http://br.geocities.com./lgcdutra/Received on Sun Mar 28 2004 - 22:17:54 CEST