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

Поиск
Список
Период
Сортировка
От Dann Corbit
Тема Re: How to set up a table where 2 columns together must be unique?
Дата
Msg-id D90A5A6C612A39408103E6ECDD77B8294CE2EB@voyager.corporate.connx.com
обсуждение исходный текст
Ответ на How to set up a table where 2 columns together must be unique?  (Scott Chapman <scott_list@mischko.com>)
Список pgsql-general
> -----Original Message-----
> From: Scott Chapman [mailto:scott_list@mischko.com]
> Sent: Friday, October 31, 2003 10:04 PM
> To: pgsql-general@postgresql.org
> Subject: [GENERAL] How to set up a table where 2 columns
> together must be unique?
>
>
> 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.

Put a unique index on user_name, user_company.

В списке pgsql-general по дате отправления:

Предыдущее
От: Scott Chapman
Дата:
Сообщение: How to set up a table where 2 columns together must be unique?
Следующее
От: Paul Thomas
Дата:
Сообщение: Re: regular backups - super user