I have created a database schema but I am not sure if it is really optimized.
Can someone please have a look at it and help me to optimize it?
It has tables Categories which will contains value like "Pizza, Salat, Pasta, Drinks".
Sizes table will contain each categoy sizes like Pizza may have sizes small,large,family,party.
And prices table will contain product_id,size_id,price.
But I am not sure if the sizes should be joined to products table or to categories as I did.
Your design may, of course, all be a perfect reflection of your underlying business domain – you don’t really give enough information to help us decide either way. I’d encourage you to phrase the schema in words, first – this usually helps understand the relationships a bit better.
I think your domain works roughly as follows:
This is sorta kinda what you’re showing in your design, except you show that it’s product category, not product, which determines which size is available. That might be right. The way to answer the question is “are there product categories in which not all products are available in the same sizes?” I think there are – drinks manufacturers, for instance, sell drinks in a range of container sizes.