Answer the question
In order to leave comments, you need to log in
How to store in the database version of one phone in the database?
Good afternoon. I'm doing something like an online store. Let's say I have a MackBoock Pro 15 laptop and it has different modifications with different amounts of RAM and ssd. For example, a user visits the MackBoock Pro 15 page and should be shown distinguishable modifications of this device. How to conveniently organize tables and links between them.
Answer the question
In order to leave comments, you need to log in
Main table - Models - three columns:
id | Model name | Major modification Modification
table:
id | Modification name | model_id
Characteristics are either stored in modification columns, which is not very good, because we would be tied to the structure of the database. Or create a separate table with characteristics:
Modification_id | Characteristic name | The value of the characteristic
The characteristics themselves can be placed in a separate table.
Worth a try with NestedSet, the product itself is the parent, and its children are just the variants of the product
The first table with device names, the second table where 1 row and in it columns device_id | other device settings. When selecting, you do a join of the first table from the second by device id
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question