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

Multiway associations

P: n/a
Hi,
I'm making my first database.

I have a list of parts, each of which is sold by multiple
vendors. I also have a list of vendors, each of which sell
multiple parts.

How should i arrange the tables for this that doesn't involve
having lots of empty fields "just in case" ?
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 22 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a

On 25/01/2004 05:06 Russell Shaw wrote:
Hi,
I'm making my first database.

I have a list of parts, each of which is sold by multiple
vendors. I also have a list of vendors, each of which sell
multiple parts.

How should i arrange the tables for this that doesn't involve
having lots of empty fields "just in case" ?

One way would be to have a separate vendorpart table something like

CREATE TABLE vendorpart
(
vendor_id int4,
part_id int4
);

which holds the relationships. You'll to define indexes, contraints and
foreign keys on it.
--
Paul Thomas
+------------------------------+---------------------------------------------+
| Thomas Micro Systems Limited | Software Solutions for the Smaller
Business |
| Computer Consultants |
http://www.thomas-micro-systems-ltd.co.uk |
+------------------------------+---------------------------------------------+

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 22 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.