How to set up a table where 2 columns together must be unique? - Mailing list pgsql-general

From Scott Chapman
Subject How to set up a table where 2 columns together must be unique?
Date
Msg-id 200310312203.43866.scott_list@mischko.com
Whole thread Raw
List pgsql-general
Hi all!

I want to create a table:

user_id: bigserial
user_name: text
user_company: text
password: text

How do I build this table so that user_name+user_company must be unique?
This way there can be only one of a given username for a given company name
but there can be more than one of a given username if they are with different
companies.

TIA,
Scott


pgsql-general by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: 7.3.5 release (was: Re: SELECT with row>32k hangs over
Next
From: "Dann Corbit"
Date:
Subject: Re: How to set up a table where 2 columns together must be unique?