Answer the question
In order to leave comments, you need to log in
JSON or intermediate table?
What is the best option for storing product sizes in a database?
1. In the product table itself, in the size column, store a list of sizes in json
2. Intermediate table
product_id | 2
size_id| {'1', '2', '3'}
3. In the sizes table, where there will be several records for one product with sizes
product_id: 3 | size: 40
product_id: 3 | size: 41
etc.
I like the third option better because you can add an available column for example.
Answer the question
In order to leave comments, you need to log in
if it is necessary for the client to make options and their values in the admin panel, then it is usually done like this:
I believe that intermediate tables (as already suggested) are the best option - from the point of view that in the future, for sure, you will want to do a Product Filter by characteristics.
The third option is better
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question