Good day everyone. I am building a database for an application and I have thought of two different approaches for achieving the same result, and I would like your opinion.
Is basically the classical product database, so at the moment I have products, each of theme belonging to a category. Each product has different features but the products that fall in the same category all share some common features.
At the moment I thought of this two structures:
- A products table, just to store the name.
- A product_categories table, to store the categories, and an intermediate table to link both.
- A features table, to store the different features.
- A product_features to link the product with it's features and store their value.
Since the products that fall on the same category have some shared features, I also thought of extracting the common features and creating a table for each product, so the result would be something like this:
- A table for each product, to store their name and common features.
- A features table, to store the different features that are not common.
- A product_features to link the product with it's features and store their value.
I believe the first structure will be easier to maintain if I need to add newer products down the line as I would not need to create any new tables, but I kind of feel that the second approach would be more correct.
Let me know your thoughts!