View Full Version : Setting up database relationships


vanderma
03-28-2006, 10:19 PM
Hello:

I am new to database design and am trying to set up a database as follows:

Component Categories table,
Parts table,
Suppliers table,

where, for every part, there are multiple suppliers, but only one default supplier; and for every category, there are multiple parts associated with the category. The DB is for an application where it is easier initially to group parts lists by category; but then eventually all of the parts in every category must be ordered, and the parts must be regrouped by supplier.

I would like to make two forms with the following information:

A component categories form with a parts subform, detailing which parts are associated with the category, and

A suppliers form with parts subform, detailing all parts from all categories that are associated with each default supplier.

I am familiar with using junction tables, but I am unsure how to set up the relationships between the three tables listed above, using direct relationships or junction tables, so that I can add parts from the parts table to either form (categories or suppliers). Could someone please help me set up my table relationships?

Pat Hartman
04-03-2006, 08:01 PM
You need a junction table between parts and suppliers since they have a many-to-many relationship. If a part can only belong to a single category, then the part table needs to have a foreign key to the category table to implement the 1-many relationship.