E
E
Eduard Bazhenov2019-09-19 11:30:57
MySQL
Eduard Bazhenov, 2019-09-19 11:30:57

How to store such data in the database?

Hello! There is a product (vertical blinds), which, depending on the width, may have a different number of slats (strips of fabric), which can be of different colors and different lengths. Items with general information are stored in a database table. What is the best way to store information about lamellas?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
K
Konstantin Tsvetkov, 2019-09-19
@kip_34

Изделие: code, description.
Состав изделия: product code, lamella code, lamella number (that is, what it is from left to right).
Ламель: code, length, color code.
Цвет: code, name.
And this is assuming that all the lamellae are of the same width.

G
Gomonov, 2019-09-19
@Gomonov

Table with colors ( table_c )
id, (fields with color description - name, standard, etc.)
Table with description of lamella ( tabel_l )
id, (fields for describing lamella: height, etc.), color_id - this is it field refers to the color
table Product table ( tabel_p ) - what you have
id, lamel_id - field refers to the table of lamellas (tabel_l), count_l - number of lamellas, (other fields for product description: width, height)

M
Mitya ToDaSyo, 2019-09-19
@dimastik1986

did you look at the dependencies?
table of names - the main one
(there is the main price per unit of measure) and an
additional table
of length, a color table
, etc.

A
Anton R., 2019-09-19
@anton_reut

Break everything into separate tables:
- Blinds table: id, description
- Length table: id, length value
- Colors table: id, color value
- Length-Colors-Blinds table: blinds id, length id, id, colors (connecting table, make all 3 columns unique so that there are no repetitions of options)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question