Re: PRIMARY KEYS

From: Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: PRIMARY KEYS
Date: 2003-05-20 12:41:15
Message-ID: 20030520144115.D562@hermes.hilbert.loc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> A primary key is a unique way to identify one row in a table.

> to have several keys, but only one would be your primary key. For example,
> here in the UK, each adult has a different National Insurance number. If you
> were writing a payroll application, you might have an internal "payroll_id"
> column as well as a "ni_num" column. Both are unique but it might make more
> sense in the application to use "payroll_id" - this is a business decision.
And - if you agree with database theory - a bad one at that.
Supposedly primary keys should be void of any meaning bar
their primary key-ness. I got into the habit of starting
any but the most simple table like this:

create table (
id serial primary key,
...

Never had any trouble with that. Good or bad practice ? Gotta
decide for yourself.

Karsten
--
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jan Wieck 2003-05-20 13:42:45 Re: Executing External Programs
Previous Message Laurent Perez 2003-05-20 12:17:11 Migrating LATIN1 dump to UNICODE db