Search Postgresql Archives

Composite Keys

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

 



First, can a primary key field be only one? I mean can I define a primary
containing two fields. 

I have a table called "Payments" where there are two fields, "ReceiptNo" and
"PaymentDate". If I take "ReceiptNo" only as a primary key then chances are
of "primary key violation". Because in some places the receipt books have 
numbers that start with 1. I mean Receipt Book 1 nos. 1-100. Receipt Book 2
nos. 1-100, and so on.

So I want to take ReceiptNo and PaymentDate as primary key field. Is it
possible to define composite key in PGSQL. Please also suggest if any other
approach would be fine.
-- 
View this message in context: http://www.nabble.com/Composite-Keys-tf3282722.html#a9131229
Sent from the PostgreSQL - general mailing list archive at Nabble.com.



[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