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
> -----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.
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера