A
A
Alexander2018-10-07 12:51:00
SQL
Alexander, 2018-10-07 12:51:00

How to implement a condition at the SQL level of the database so that products, depending on the type of their category, have different properties?

It is planned to create an online store in it there will be several categories of goods, while the goods of different categories will be very different from each other. For example, category 1 is telephones/mobile devices, category 2 is office furniture.
Since products of different categories have practically no common properties, depending on the type of category, the products will have different properties. For example , a product Apple iPad (2018) 32Gb tablet (mobile devices category) will have the following properties: built-in memory, operating system, screen size, etc. The product Computer table Mon_SK 01 Beech will have the following properties: furniture material, dimensions, assembly scheme.
The question is how to implement business logic at the SQL Database levelwith the condition that the goods, depending on the type of their category, have different properties?
At the logic level of the online store, the following entities are planned : city, product category, product with properties.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Gornostaev, 2018-10-07
@sergey-gornostaev

Either EAV or JSON type fields.

I
Ivan Shumov, 2018-10-07
@inoise

Database for storing data. Business logic in the application. Don't mix

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question