For my website i have tables
Category :: id | name
Product :: id | name | categoryid
Now each category may have different sizes, for that I have also created a table
Size :: id | name | categoryid | price
Now the problem is that each category has also different ingredients that customer can choose to add to his purchased
product. And these ingredients have different prices for different sizes.
For that I also have a table like
Ingredient :: id | name | sizeid | categoryid | price
I am not sure if this Structure really normalized is. Can someone please help me to optimize this structure and which indexed do i need for this Structure?
Category :: id | name
Product :: id | name | categoryid
Size :: id | name |
Ingredient :: id | name |
Category_Size :: id | categoryid | SizeID | Price
Category_Ingredient :: id | categoryID | IngredientID | Price
All complex entities are broken into least possible parts (individual table). Then used foreign key relations to relate them logically.