D
D
DalvJoker2020-06-12 11:46:23
MySQL
DalvJoker, 2020-06-12 11:46:23

How to organize the correct table structure for an online store goods - suppliers?

Good day. When designing a database (Spanish MySQL) for an online store, a dilemma arose. There is a product table. A product can have several suppliers (nomenclature item number). Suppose there are 10 suppliers and 10 products. I have two options for storing data:
1. two tables: products(id,....) and providers(id_product,p1,p2,...,p10) - pluses one to one, since there will be about 20k products. Cons to add a supplier, you will need to change the structure of table
2. three tables: products(id,...),providers(id,name),product_providers(id_product,id_providers,code) - the pros seem to be similar to EAV, but not sure about performance .. And by the number of records in the table. And you can easily add a new supplier.

The cost of goods from suppliers is not taken into account.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dmitriy, 2020-06-13
@dmitriylanets

Products - positions - providers

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question