How to set up a table where 2 columns together must be unique?

From: Scott Chapman <scott_list(at)mischko(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: How to set up a table where 2 columns together must be unique?
Date: 2003-11-01 06:03:43
Message-ID: 200310312203.43866.scott_list@mischko.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Browse pgsql-general by date

  From Date Subject
Next Message Dann Corbit 2003-11-01 06:19:01 Re: How to set up a table where 2 columns together must be unique?
Previous Message Bruce Momjian 2003-11-01 04:56:56 Re: 7.3.5 release (was: Re: SELECT with row>32k hangs over