I started a new application, and now I am considering two ways and do not know which one is a good way.
I am creating something like an eCommerce site. I have categories and subcategories .
The problem is that there are different types of products on the site, each of which has different properties . And the site should be filtered by these product properties.
This is my initial database design:
Products{ProductId, Name, ProductCategoryId} ProductCategories{ProductCategoryId, Name, ParentId} CategoryProperties{CategoryPropertyId, ProductCategoryId, Name} ProductPropertyValues{ProductId, CategoryPropertyId, Value}
Now, after some analysis, I see that this project is really EAV , and I read that people usually do not recommend this design.
Everyone seems to need dynamic SQL queries.
This is one way, and I'm looking at it right now.
The other way that I see is probably called LOT WORK WAY, but if it's better, I want to go there. To make a table
Product{ProductId, CategoryId, Name, ManufacturerId}
and do table inheritance in the database, which means creating tables like
Cpus{ProductId ....} HardDisks{ProductId ....} MotherBoards{ProductId ....} erc. for each product (1 to 1 relation).
I understand that it will be a very large database and a very large application domain, but it is better, simpler and works better than the EAV design option.