Search Postgresql Archives

Re: pervasiveness of surrogate (also called synthetic) keys

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





2011/4/28 Merlin Moncure <mmoncure@xxxxxxxxx>
On Thu, Apr 28, 2011 at 12:29 PM, Jim Irrer <irrer@xxxxxxxxx> 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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux