Multiple categories

  • Thread starter Thread starter Anita
  • Start date Start date
A

Anita

Hi

I have a database that I need to design of a list of
websites that would then be put into categories. My
problem is that 1 website could be put into multiple
categories and I don't know how to do this without
creating multiple tables

Thank you for any help you can give me.
 
You have a many-to-many relationship between categories and websites. You
resolve that with a junction table.

tblCategory:
CategoryID primary key
CategoryName

tblWebsite:
WebSiteID primary key
Website

tblWebSiteCategory:
WebSiteID foreign key to tblWebsite.WebSiteID
CateogryID foreign key to tblCategory.CategoryID
 
Thank you for this, but could I make it a bit more
complicated? I have 2 main categories with sub
categories which I have made into 2 separate tables, the
websites can be categorised into the 2 main categories and
then they can be categorised again into multiple sub
categories. What would be the best way of doing this?

Many thanks again for this.
 
Combine the 2 category tables into one, with an additional field to tell
them apart.

You can then select them as needed in your queries, but it doesn't come into
the issue we were discussing. It's like every one of your existing
categories is a member of one of the super-categories.
 
Back
Top