Re: pervasiveness of surrogate (also called synthetic) keys

From: Misa Simic <misa(dot)simic(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: pervasiveness of surrogate (also called synthetic) keys
Date: 2011-05-04 11:14:50
Message-ID: BANLkTikcZpcH_kQ-_6j_DZNQqMwaJDGHrg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2011/4/28 Merlin Moncure <mmoncure(at)gmail(dot)com>

> On Thu, Apr 28, 2011 at 12:29 PM, Jim Irrer <irrer(at)umich(dot)edu> wrote:
> *) most tables don't have unique natural keys (let's see em)
> etc
>
>
i.e for an Invoice, we have at least 2 tables (more in practice...):

Invoice Header
-Invoice Number
-Date
-CustomerID
-Currency

Invoice Line
-ItemID
-qty
-Price

This is not real design for tables, just basic real info stored to represent
1 Invoice Document.

Now, let say for Invoice Header, "Natural" PK is Invoice Number, so we will
add that column to Invoice Line table as FK....

What should be "Natural" PK for Invoice Line table?

Also, if we now add additional tables i.e. Serial Numbers, related to
Invoice Line, what should be "Natural" key in it?

Thanks,

Misa

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Gabriele Bartolini 2011-05-04 11:16:38 Re: multiple group by on same table
Previous Message Sim Zacks 2011-05-04 10:59:21 Re: multiple group by on same table