When planning our database, we ended up with a setup like this:
We have Company
, Product
and Person
.
There is a many-to-many relationship between Company
and Product
, through a junction table Company_Product
, because a given company may produce more than one product (such as "car" and "bicycle"), but also a given product, such as "car", can be produced by multiple companies. In the junction table Company_Product
there is an extra field "price" which is the price in which the given company sells the given product.
There is another many-to-many relationship between Company_Product
and Person
, through a junction table Company_Product_Person
. Yes, it is a many-to-many relationship involving one entity that is already a junction table. This is because a Person can own multiple products, such as a car from company1 and a bicycle from company2, and in turn the same company_product can be owned by more than one person, since for example both person1 and person2 could have bought a car from company1. In the junction table Company_Product_Person
there is an extra field "thoughts" which contains the thoughts of the person at the moment they purchased the company_product.
Is this commonly-acceptable or is this a sign that something is wrong? If it's weird, what would be a better solution?
I've been running into a few problems with this (such as this one), so I was wondering, perhaps my database setup is wrong to begin with.