RE: Relational Database Design Question - Category Tree

  • From: james.homme@xxxxxxxxxxxx
  • To: programmingblind@xxxxxxxxxxxxx
  • Date: Wed, 12 Sep 2007 11:06:44 -0400

Hi Rodney,
Yes. A Category can belong in another category. For example, a text editor
can also be an HTML editor. I picked that example out of mid air.

Jim

James D Homme,
Usability Engineering
Highmark Inc.
james.homme@xxxxxxxxxxxx
412-544-1810

"It's more important for me to start to do the right thing than it is to
wait until I think I
can do it just right."



                                                                           
             "Rodney Haynie"                                               
             <RodneyH@xxxxxxxx                                             
             om>                                                        To 
             Sent by:                  "programmingblind@xxxxxxxxxxxxx"    
             programmingblind-         <programmingblind@xxxxxxxxxxxxx>    
             bounce@freelists.                                          cc 
             org                                                           
                                                                   Subject 
                                       RE: Relational Database Design      
             09/12/2007 10:18          Question - Category Tree            
             AM                                                            
                                                                           
                                                                           
             Please respond to                                             
             programmingblind@                                             
               freelists.org                                               
                                                                           
                                                                           




Conceptually speaking.

In your project, I understand that an item can belong to multiple
categories.
That is just fine, and you are absolutely correct to want a separate table
that links items to categories.

Now let me ask:
Can a category to belong to multiple categories?
Or, does a category only belong to one category.

After you answer that, then we can chime in with suggestions.


Thanks.
Rodney



-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of
james.homme@xxxxxxxxxxxx
Sent: Wednesday, September 12, 2007 7:53 AM
To: programmingblind@xxxxxxxxxxxxx
Subject: RE: Relational Database Design Question - Category Tree

Hi Rodney,
The reality is that I don't know what I am doing. I don't know how to force
a category to have one parent. I don't know how to allow a category to have
multiple parents.

Thanks.

Jim

James D Homme,
Usability Engineering
Highmark Inc.
james.homme@xxxxxxxxxxxx
412-544-1810

"It's more important for me to start to do the right thing than it is to
wait until I think I
can do it just right."




             "Rodney Haynie"
             <RodneyH@xxxxxxxx
             om>                                                        To
             Sent by:                  "programmingblind@xxxxxxxxxxxxx"
             programmingblind-         <programmingblind@xxxxxxxxxxxxx>
             bounce@freelists.                                          cc
             org
                                                                   Subject
                                       RE: Relational Database Design
             09/12/2007 07:24          Question - Category Tree
             AM


             Please respond to
             programmingblind@
               freelists.org






4 tables... Less duplicate data... That is true if you allow a category to
have more than one parent.

The key is to implement a scheme that you are comfortable with.
-Rodney


-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of
james.homme@xxxxxxxxxxxx
Sent: Wednesday, September 12, 2007 7:04 AM
To: programmingblind@xxxxxxxxxxxxx
Subject: Re: Relational Database Design Question - Category Tree


Hi,
I think I should use four tables because there would be less duplicate
data. Here is the summary of this thread as it was on the old list.

Me:
I want to depict a tree in a relational database. Here is what is going
to happen. There will be a table that has items in it. The items can fall
into
categories. That means there will be a table of categories. An item can
be in more than one category. I think this means that I need a third table.
The third table will hold the number of an item from the items table and
a number of a category  from the categories table.
I think I need another table that has
a category number and a parent number. This would let me depict the
categories inside other categories.

Rodney:
I would say you only need 3 tables:
1. Item
2. Category
3. ItemCategory
I don't think you need another table because you can simply put the
ParentCategoryID into the category table.  You would join the category
table to itself to get the parent category.

Humberto:
I think that you can handle the category and subcategory like eBay does.
There is a field category_id and another field subcategory_of in the
categories table.  When the subcategory_of field is the same as the
category_id field, you are at a top level category.

Jim
James D Homme,
Usability Engineering
Highmark Inc.
james.homme@xxxxxxxxxxxx
412-544-1810

"It's more important for me to start to do the right thing than it is to
wait until I think I
can do it just right."

__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind



__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind



__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: