Hello.
The task is this: there is an online shoe store, one shoe model exists in several sizes. How best to organize the storage of information about these balances in MySQL databases? Give an idea!
Hello.
The task is this: there is an online shoe store, one shoe model exists in several sizes. How best to organize the storage of information about these balances in MySQL databases? Give an idea!
If the number of different sizes is small, then you can make one record for each model and store the remnants of different sizes in the fields of this record. And even if some individual models have an extended set of sizes, then for such models you can add a second (dummy) entry. She will not be filled with the name of the model, or any other fields that describe a separate model. There will be only an ID stored in one of the fields of the main record, and the remnants of additional sizes. In this case, the minimum size from the additional record should be interpreted as the size following the maximum of the main one.
Separate table, where model ID, size and balance are stored.
As an option, add 3 tables: table_properties, table_values of properties, table_connection of the value with the goods.
And then calmly fill properties with values (for example, color {red blue green}, size {41, 42, 43}, etc.).
Tying several properties to the product, we get the product with several modifications.
Plus - you do not need to add fields in the tables for new properties of the product, you do not need to produce records with the goods.
Minus - complex communication logic.
PS is the implementation of this logic on heavily loaded projects. The filter sampling rate has a positive effect.
Source: https://ru.stackoverflow.com/questions/137937/
All Articles