Answer the question
In order to leave comments, you need to log in
How to organize the database structure for dynamic characteristics?
Comrades, please tell me the best way to organize the MySQL database structure for a dynamic system of characteristics and search by them.
More specifically: There are houses. Houses have characteristics. The values of these characteristics can be a number, a string, or a boolean. It is necessary to organize the base so that the characteristics can be added. At the same time, each house has its own values for the same characteristic. In this case, it will be necessary to organize filtering according to these characteristics.
My option:
When using MySQL, as it is now shown in my picture, all filtering will have to be done through CAST or CONVERT.
So I'm thinking about the best way to organize this.
Answer the question
In order to leave comments, you need to log in
How to add a product to the cart?
- EAV (link provided by @muhammad_97);
- JSON/XML in a relational database;
- JSON in document base (CouchDB/MongoDB) (preferred option);
In the characteristics table, make specifically three fields, instead of type
Id (int)
name (varchar)
string_option (varchar)
number_option (int/float/decimal)
bool_option (boolean)
prefix (varchar)
suffix(varchar)
And store selectively values for each field
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question