473,320 Members | 2,029 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Having multiple catagories..

101 100+
What's the best way to list multiple categories in a record/table? To give you an idea, I'll use a animals as an example.

If I use a field called "type", I could put in "pet" for a "dog" record. But it can also be categorized as "mammal". So, to deal with this, I would create another joining table with the fields "ID" and "Category" and add all the records for that one ID.

Ex:
ANIMALS TABLE
ID NAME
001 Dog
002 Monkey

CATEGORIES TABLE
ID CATEGORY
001 Domestic
001 Mammal
001 Carnivore
002 Mammal
002 Herbivore

However, if I'm dealing with thousands of records and categories, what then? And what if I wanted to make use of a tree structure? Is there a better way than this?
Oct 3 '07 #1
1 1194
What's the best way to list multiple categories in a record/table? To give you an idea, I'll use a animals as an example.

If I use a field called "type", I could put in "pet" for a "dog" record. But it can also be categorized as "mammal". So, to deal with this, I would create another joining table with the fields "ID" and "Category" and add all the records for that one ID.

Ex:
ANIMALS TABLE
ID NAME
001 Dog
002 Monkey

CATEGORIES TABLE
ID CATEGORY
001 Domestic
001 Mammal
001 Carnivore
002 Mammal
002 Herbivore

However, if I'm dealing with thousands of records and categories, what then? And what if I wanted to make use of a tree structure? Is there a better way than this?
I currently don't have any suggestions on a different table schema, but if you keep it like you have it, you can make the ID in the categories table a foreign key into the ID of the animals table. This will make sure that no invalid IDs are entered into the categories table.
Oct 3 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: AARON PECORARO | last post by:
I need to split apart my web application into multiple projects to allow it to be distributed in parts, but all of the projects need to work together (ie. they need to share session information)....
1
by: malcolm | last post by:
Hello, We have a small team building a project that involves some 30 or so c# assembly dlls. It is a client server application with 1 exe as the starting point. The dlls and exe are sharing an...
16
by: Fronsac | last post by:
Hi, I've been asked in a job interview how to make C code look like C++ code, and honestly I didn't know what to answer because I have never really done a lot of C. Now, I've been searching around...
3
by: Henrik Dahl | last post by:
Hello! From default, the ASPNET user is giving the process identity for the ASP.NET runtime environment of IIS, however it's possible to change the user by modifying the <processModel> element...
2
by: Mikey P | last post by:
Hi all, I'm trying to do a query from 2 databases. Basically i have catagories within 2 databases. If both catagories return 0 rows then it does nothing but if one or both have rows returned then i...
14
by: Gotisch | last post by:
Hi, we are currently writing an mostly singlethreaded (game)server application in c#. But we are encountering problems with the Garbage Collector: After a certain time but also apparently...
4
Fary4u
by: Fary4u | last post by:
Hi every one any body can help me in this regards ? i don't know how to do that how do i convert following code into sub catagory ? like . . . Computer Mainboards Keyboards Mouse Process...
1
Fary4u
by: Fary4u | last post by:
Hi every one any body can help me in this regards ? i don't know how to do that how do i convert following code into sub catagory ? like . . . Computer Mainboards Keyboards ...
4
AaronL
by: AaronL | last post by:
Hello, I am developing an e-commerce system and I want to be able to create catagories and subcatagories for items. I have the basics down however I may be making things too complicated. First I...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.