Can I assign 2 primary keys to link tables?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a table of items purchased with suppliers and cost. I would like to
be able to insert 2 suppliers with option to insert an item that is a
duplicate. My suppliers and items purchased are separate tables that are
linked. How can I choose to link the two tables so that two suppliers can
share the purchase of the same item stock number?
 
You either need a separate primary key that is independent of the supplier
and the stock number, or you need a composite primary key that uses both the
supplier and the stock number fields.
 
I have a table of items purchased with suppliers and cost. I would
like to be able to insert 2 suppliers

This looks awfully like a one-to-many relationship between ItemsBought
and Suppliers. Actually, if a Supplier can supply more than one Purchase,
then I guess it's a many-to-many:

ItemsBought(*ItemCode, *DateBought, SignedOffBy)

Suppliers(*CompanyCode, ContactName, HeadOfficeAddress, etc)


Contributions(*ItemCode, *DateBought, *Company, AmountPaid, etc)
(ItemCode, DateBought) is a FK referencing ItemsBought


"Contributions" is probably a rotten table name, but I am imagining that
each supplier contributes to part of the order. You are sure to have a
much more appropriate vocabulary for that kind of thing.


Hope that helps


Tim F
 
Thanks very much. I will try this. Hope it works! My boss (husband for
whom I work) has been very unhappy because the only design I had made it
necessary to delete one supplier (vendor) to replace the one from whom we
wanted to make the purchase.
 
Back
Top