We are doing e-commerce shopping site in PHP.

We designed database as below image.

we are planning to delete "category_Details" table and include "category_id & category_name" columns in "products_information" table as this going reduce one table. Is this good idea or is it better to have separate columns for "categories"? We may end up with 15 rows under "category_name" column. We are planning to merge as we have to use multiple joint queries to fetch information?

In image designer_details table contains all sellers/vendors who sell their products.

enter image description here


1 Answer 1


It is not a good idea to put the category_name in the product_information. This way you will 'break' the normalization. Instead of storing the category_name 15 times you store the same name multiple times. You speak about gaining on joining but this will give you, taken the limited number of rows in category_details, not much advantage. The whole category_details table will be in memory and you only need to join if you need the category_name.

You say that you have about 15 categories. I suppose that you have (many) more product. So this makes it a one-to-many relation which is the second case in the answer to MySQL: multiple tables or one table with many columns? that you mentioned in a comment. There it mentions that in the case of a one-to-many relation you must put the information in separate tables.

Also look at the application level. If somebody has to enter each time a category_name you might end up with the same name but spelled different. This will make it hard to search on it.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.