Answer the question
In order to leave comments, you need to log in
How to make database structures for automotive products?
Given:
id | name | model | pokolenie | komplektaciya | kuzov | dvigatel
1 | Название товара | {1,2} | {1,2,3} | {1,2,3,4,5} | {1} | {1,2,3,4}
id | model_id | prod_id
1 | 1 | 1
2 | 2 | 1
id | pokolenie_id | prod_id
1 | 1 | 1
2 | 2 | 1
3 | 3 | 1
id | name
1 | Название товара
Answer the question
In order to leave comments, you need to log in
Under no circumstances use JSON to store data that is supposed to be even ostensibly searchable. Before planning a database, it is recommended to read about database normalization
Why normalize a database?
You may have a question - why even normalize the database and deal with this redundancy?
The fact is that data redundancy creates the prerequisites for the appearance of various anomalies, reduces productivity, and makes data management inflexible and not very convenient. From this we can conclude that normalization is needed to:
Eliminate anomalies
Improve performance
Improve the convenience of data management
Now show how your first option would look like if, for example, model 1 in trim 1 can have engines 2 and 3, in trim 3 engines 3 and 4, and in other trim levels it is not available. And the Model 2 comes in trims 2, 3, 4 and 5, but the engine also depends on the trim. And if it still depends on the generation?
4 tables
Manufacture manufacturer
Model/stage
Options body parts and miscellaneous
Parts List of all parts from options
Plus a few auxiliary tables from the original manufacturer purely for convenience. Lowered the accounting and your machinery
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question