Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old August 31st, 2006, 05:39 AM
Registered User
 
Join Date: Jun 2004
Location: , , United Kingdom.
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Unlimited categories

Hi

I'm trying to think of the best way to have a database of items which would have unlimited sub categories, i.e. Main category of Cars then sub category of Manufacturer a sub of that say Parts and so on.

Do you have any ideas on how this could be done as i have only had experience of having a set number of sub categories in seperate tables and i know this isn't the correct way of doing it?

Is it possible to have all the categories and subcategories listed in the same table and linked somehow?

Sorry if i have worded the question strangely but i can't get my head around how to solve this problem.

Thanks

Paul

  #2 (permalink)  
Old August 31st, 2006, 06:15 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

You would do this:

tblManufacturer
ManufacturerID - PK
ManufacturerName - text
etc

tblCar
CarID - PK
CarName - text
ManufacturerID - FK to tblManufacturer
etc

tblPart
PartID - PK
PartName - text
PartDescription - text

Then create a junction table to join parts to cars:

tblJunction
JunctionID - PK
CarID - FK to tblCar
PartID - FK to tblPart
etc

This last table is how yu have all cars and their parts listed together in the same table and linked.

Does this help?


mmcdonal
  #3 (permalink)  
Old August 31st, 2006, 07:21 AM
Registered User
 
Join Date: Jun 2004
Location: , , United Kingdom.
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the reply.

I understand what you've said but it's not quite what i'm trying to do.

I'm looking to make a website which lists lots of categories with lots of levels of subcategories which can be added/updated/deleted all the time and i want my database, which i'm playing about with in Access before i decide anything properly, to be able to cope with any amount of subcategories without having to create any more tables as there is potential for alot of categories and other other categories below those.

I hope i tried to clear up to you what i'm trying to do.

Thanks again for your help

Paul



Similar Threads
Thread Thread Starter Forum Replies Last Post
Multilevel unlimited subcategory ? atul PHP Databases 0 September 22nd, 2007 12:37 AM
Deleting Categories spardoe BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 4 July 19th, 2006 03:07 AM
Unlimited scrolling dartcoach VB How-To 3 January 19th, 2006 12:15 AM
cin and unlimited data set size phenix151 C++ Programming 4 October 13th, 2003 09:21 AM
Get unlimited input from user WO using sentinel # frank_jarle J2EE 4 July 9th, 2003 03:42 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.