Answer the question
In order to leave comments, you need to log in
How to design a database of item content in products?
There is a table for the content of microelements in food products
(Content of an element in 100 g of product)
As I understand it, I should have a separate table with food and a separate table with microelements and then somehow correlate them and enter the content of each substance in each product. Or should I still have one table with columns of all elements, roughly speaking, as in the picture? Or maybe make a field with the json type?
It is important that in the future it will be possible to conveniently work with this by adding data through the site admin panel. Plus, it is also planned that this functionality will be further expanded and interact with other modules on the site.
What is the best way to store data in this format?
Answer the question
In order to leave comments, you need to log in
Related tables.
- product
table - element
table - dimension
table - union table (reference to product, element, dimension and value)
Ranges are very confusing, but they can be written as from-to
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question