Reputation: 450
I have a form for an invoice creation and my task is that I want a user to be able to limit a customer's selection of data from a database based on selections the user has previously made.
My constraints are that each company has access to all products but the price for the same product will be different for different companies. Also each product may come in different sizes, which will have different prices.
Need help understanding the logic behind creating the connections between these classes.
For instance my entities:
Company (attributes: CustID, Name, ShipTo, SoldTo, City, State, ZipCode)
Product (attributes: UN, Name, Hazard, Packing Class, Grade, Weight, Unit Type)
Now each product can come in many sizes, and each size has many products associated with it. So I created a junction table titled Type
with attributes Size
and UN
and linked in the Product and Type table together.
Then I created another junction because each company could have the same product and each product could be sold to many companies, and titled it CustProduct
with attributes CustID
and UN
and linked it to Product table and Company Table.
Now I'm getting confused, how and where do I create a relationship that will allow link a unique price to product
with a determinable size
sold to a specific Company
? Banging my head on this.
Upvotes: 0
Views: 79
Reputation: 504
There is a many to many relationship beetween Company and Product table. By doing that, every product has different sizes and prices depending on a specific company
I think you can achieve your goals by implementing this structure.
Upvotes: 0
Reputation: 201
From what you're saying, here is what I think:
This means that each company can specify the price for each size of each product.
I hope that helps.
Upvotes: 1