Composite Keys

From: RPK <rohitprakash123(at)indiatimes(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Composite Keys
Date: 2007-02-24 05:28:12
Message-ID: 9131229.post@talk.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


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.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Gene 2007-02-24 05:46:47 how to tell if using unnamed paramaterized queries?
Previous Message RPK 2007-02-24 05:20:41 Re: Installing PGSQL Client