| From: | "Loeke" <LoekeDoeLoekeDoe(at)dontlikespam(dot)hotmail(dot)com> |
|---|---|
| To: | pgsql-sql(at)postgresql(dot)org |
| Subject: | Re: question : the choice of the primary key. |
| Date: | 2004-01-07 14:17:55 |
| Message-ID: | 1073485069.11869@seven.kulnet.kuleuven.ac.be |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
> 1.many people make an extra id field and choose this id field to be the
> p-key,
> but then the same person can be present twice in the table (with different
> id fields), the id in itself has no real meaning
> 2.or u can choose the "natural" key for each person, lets say a name and
the
> birthdate of a person make that person unique, so lets make (the whole
name
> en the birthdate) the primary-key; but then if another table X wants to
> refer this table of persons using a foreign key, this foreign key exists
out
> of 3 fields, which smells redundant
i solved it for now
using a p-key (the short id)
and a a-key (the natural key),
so integrity is ok and refences are short.
>
> u have often this choice in determining the primary keys,
>
> plz give me your opinions, options i overlooked or usefull comments.
>
>
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Andreas | 2004-01-07 17:09:04 | Notation of index |
| Previous Message | Kenneth Gonsalves | 2004-01-07 14:17:32 | unique constraints |