Answer the question
In order to leave comments, you need to log in
What is the best way to organize the database schema?
Hello!
The situation is this:
There are goods, there are shops. Different stores may have the same product, but the price will be different.
What is the best way to organize the base in this case?
It comes to my mind to make a separate table where the product - store relationship and the column with prices for each specific relationship will be stored, but is this correct?
Application in php, laravel 5.1, MySQL database
Sorry if the question is stupid, but I want to hear advice and do everything right.
Answer the question
In order to leave comments, you need to log in
I organized it through many-to-many relationships. You will need table pivots. How to optimize a select query in Laravel5 (many-to-many) ? I asked a question. There is little description. I saw somewhere more about pivot tables, but I can't find it.
I didn’t understand the question halfway, your terminology is hard.
My suggestion:
- table Shop(id, ...);
- table Goods(id, ...);
- table ProductPrice(shop_id, product_id, price);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question