Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Database Product Categories Question

Guest
Mar 25, 2011 Mar 25, 2011

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.

TOPICS
Server side applications
366
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 25, 2011 Mar 25, 2011
LATEST

>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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines