Skip to main content
March 25, 2011
Question

Database Product Categories Question

  • March 25, 2011
  • 1 reply
  • 365 views

Hi. This question relates more to database structure than anything else but I hope someone can please help.

I have a 'catalogue' of products which need to be put on a database driven website. Around 200 products. Many products fall into 2 categories but some fall into more.

For example: A wooden rolling pin my fall under 'Wood', 'Cooking' and 'Dough Accessories'.

What would be the best way of designing my database so that I have the most flexibility for product navigation in the future.

As it stands, I have all the products, descriptions, etc in a flat-file database. The products have not been given any categories. My only idea has been to add 3 more fields each saying 'Category 1' 'Category 2' and 'Category 3'. Would this work?

Thanks!

Chris

P.S. If I have not been clear enough please say.

This topic has been closed for replies.

1 reply

Participating Frequently
March 25, 2011

>My only idea has been to add 3 more

>fields each saying 'Category 1' 'Category 2' and

?>'Category 3'. Would this work?

You could make this work, but it's the wrong approach and will cause major headaches for you. The correct method would be to create a category table, and another table that links the categories to the products. Each row in the link table would contain the primary keys from the product and category table.