pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Loeke <LoekeDoeLoekeDoe@dontlikespam.hotmail.com>
To: pgsql-sql@postgresql.org
Subject: question : the choice of the primary key.
Date: Wed, 7 Jan 2004 00:38:08 +0100
Message-ID: <1073432278.456150@seven.kulnet.kuleuven.ac.be> (raw)

U have for example something like this

create table persons(
(id..),
surename ..,
familyname ..,
street ..,
..,
birthdate,..
)

a table containing the data of persons, each persons should of course be
present only once;
and one should still define a primary key,
there are two options now,
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

u have often this choice in determining the primary keys,

plz give me your opinions, options i overlooked or usefull comments.





view thread (2+ messages)  latest in thread

Message-ID: <1073432278.456150@seven.kulnet.kuleuven.ac.be>
Permalink:  ../1073432278.456150@seven.kulnet.kuleuven.ac.be/
Also on:    postgresql.org/message-id/1073432278.456150@seven.kulnet.kuleuven.ac.be

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: LoekeDoeLoekeDoe@dontlikespam.hotmail.com
  Subject: Re: question : the choice of the primary key.
  In-Reply-To: <1073432278.456150@seven.kulnet.kuleuven.ac.be>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox