Composite Keys - Mailing list pgsql-general

From RPK
Subject Composite Keys
Date
Msg-id 9131229.post@talk.nabble.com
Whole thread Raw
Responses Re: Composite Keys  ("Joshua D. Drake" <jd@commandprompt.com>)
Re: Composite Keys  (Jorge Godoy <jgodoy@gmail.com>)
List 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.


pgsql-general by date:

Previous
From: RPK
Date:
Subject: Re: Installing PGSQL Client
Next
From: CaT
Date:
Subject: Re: postgresql vs mysql