O
O
ortsuev332018-10-04 09:10:38
Database
ortsuev33, 2018-10-04 09:10:38

What is the best way to make a table structure for products?

I have a table with products, there are products that have data on their color, weight, etc., and there are products that do not have such data, and in principle they are not needed, how to store them in the database?
Create a common table products (and make them fields just null when inserting), or create several?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
EVGENY T., 2018-10-04
@ortsuev33

Option 1.
Tables:
Good(id, name) - goods,
Param(id, name) - parameter reference,
ParamVal(id_good, id_param, val) - parameter values.
Store parameters in one field but inside xml
Good(id, name, vals-xml)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question