N
N
Nikita Dergachov2017-08-11 12:59:34
MySQL
Nikita Dergachov, 2017-08-11 12:59:34

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

3 answer(s)
D
DTX, 2017-08-11
@vanillathunder

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.

R
Rikcon, 2017-08-11
@Rikcon

Worth a try with NestedSet, the product itself is the parent, and its children are just the variants of the product

V
Viktor Yanyshev, 2017-08-11
@villiwalla

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 question

Ask a Question

731 491 924 answers to any question