Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Composite Keys



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.




Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group