S
S
Sergey Khlopov2019-11-26 11:20:04
Database design
Sergey Khlopov, 2019-11-26 11:20:04

What is the best way to make relationships between tables and the tables themselves?

Hello, tell me please, now I am making an admin panel for the site, there is an opportunity to add categories, and attach a lot of characteristics to these categories, when a product is added to a category, it receives those characteristics that were attached to the category. And by the way, one characteristic can contain several values, that is, for example, the "Size" characteristic of a product can have several different values. Now in general what I have:

  1. Table categorieswith categories
  2. Table characteristicswith characteristics
  3. Table category_characteristicconnecting categories with characteristics relationship (many-to-many)
  4. Table productswith goods

Please tell me how best to design tables and relationships so that it would be possible to save such information, for example, (I will sign it in full, but if my question is exactly how to store information that product X has such and such characteristics and these characteristics such values)
Категория № 1 имеет характеристики {Размер, Материал}
   Товар №1.1 
      Наследует характеристики от своей категории: Размер, Материал
      Значения характеристик: Размер: {"Большой","Маленький","Средний"}, Материал: {"Какой то материал"}

And then for example
Категория № 2 имеет характеристики {Размер, Материал, Цвет}
   Товар №2.1 
      Наследует характеристики от своей категории: Размер, Материал, Цвет
      Значения характеристик: Размер: {"Большой","Маленький","Средний"}, Материал: {"Какой то материал2"}

Thank you in advance for your response

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question