By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,852 Members | 2,200 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,852 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 12 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.