Each product will have a parent category, a category, and a subcategory.
Would it be better to have a normalized database with integers representing parent category, category and subcategory on the product table?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Its better to have the category table separate and have ids in the product table. else you if you directly store category info in product table you will end up with consistency and duplication.
you can always join the table while pulling the products, if you are worried of joining you can also cache the categories table in the application side and do a lookup in to the category hash map while picking a product from the table to know about its parent and sub category info.