0

Hi guys,

Hope i'm putting this in the right place. Apologies if i'm not!

I'm making a website for a sports suppliments supplier. I'm having some trouble with how to layout the database.

I have a navigation menu which has all the categories listed. But some of my products are listed in multiple categories. I can't figure out how to layout my database.

I have in table products:

Product_ID, Category_ID, Product_Name, Product_Description

And in table categories I have:

Category_ID, Category

How do I go about putting a product into multiple Categories?

Thanks guys!

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by peck3277
2

You've to make another table ProductCategories containing:
CategoryID, ProductID

And table product should contain:
ProductID, Product_Name, Product_Description

table categories is the same:
Category_ID, Category

In your version of the products table there is functional dependency, so you have to normalise it.. Hope this will help you

0

Finally got to do as you said and it now works perfectly.

Thanks!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.