I want to store a list of Sellers, who sell a certain Category of products each, and then, each Seller will have Products from these Categories.
What is the best way to design this? Currently, what I have is three tables, Seller, Category and Product designed in this way.
How do I link Seller and Category? I feel like I am creating too many relationships here.
One way would be to create a separate table with indices for SellerId and CategoryId. Also, I think I will need a separate table for SellerId and ProductId too. Is there a better way to approach this design?
1 seller can have multiple categories,
1 category can have multiple sellers,
1 category can have multiple products,
1 product can again, have multiple sellers,
1 product can have only 1 category,
and last, 1 seller can have multiple products.
Seller
can have multipleCategory
records and any givenCategory
can have multipleSeller
records then they would need such a linking table between them. What's unclear to me, then, is theProduct
relationships. If aProduct
is owned by both aCategory
and aSeller
then there's no guarantee of the integrity of that relationship. ThatSeller
might not be linked to thatCategory
. Should aProduct
be owned only by aCategory
perhaps? And anySeller
with thatCategory
has access to thatProduct
? – David