RE: Relational Database Design Question - Category Tree

  • From: Jamal Mazrui <empower@xxxxxxxxx>
  • To: programmingblind@xxxxxxxxxxxxx
  • Date: Wed, 12 Sep 2007 21:19:21 -0400 (EDT)

If an organizing scheme more flexible than a tree is desired, perhaps the
term "keyword" would be more appropriate than "category."  Each item
could have any number of keywords.

Just a thought,
Jamal
On Wed, 12 Sep 2007, Humberto
Rodriguez wrote:

> Date: Wed, 12 Sep 2007 18:17:44 -0400
> From: Humberto Rodriguez <sub@xxxxxxxxxxxxxxx>
> Reply-To: programmingblind@xxxxxxxxxxxxx
> To: programmingblind@xxxxxxxxxxxxx
> Subject: RE: Relational Database Design Question - Category Tree
>
> To avoid having a field called level, which you could also easily have,
> with a type of tinyint, you could determine when a category is at top
> level if the category id is the same as the subof.
> Humberto
>
>
> -----Original Message-----
> From: programmingblind-bounce@xxxxxxxxxxxxx
> [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Rodney
> Haynie
> Sent: Wednesday, September 12, 2007 4:13 PM
> To: programmingblind@xxxxxxxxxxxxx
> Subject: RE: Relational Database Design Question - Category Tree
>
>
> Jim,
> I agree with Humberto in that it does not matter.
>
> But, Humberto, I did not understand the rest of what you were trying to
> say about setting the levels of each sub category.  Could you please
> ellaborate?
>
> Thanks.
> Rodney
>
>
> -----Original Message-----
> From: programmingblind-bounce@xxxxxxxxxxxxx
> [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Humberto
> Rodriguez
> Sent: Wednesday, September 12, 2007 4:03 PM
> To: programmingblind@xxxxxxxxxxxxx
> Subject: RE: Relational Database Design Question - Category Tree
>
> Hello Jim:
>
> It doesn't matter.  The only thing you need to make sure of is that each
> category has an equal subcategory, to set the level of each category.
> HTH,
> Humberto
>
>
> -----Original Message-----
> From: programmingblind-bounce@xxxxxxxxxxxxx
> [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of
> james.homme@xxxxxxxxxxxx
> Sent: Wednesday, September 12, 2007 3:51 PM
> To: programmingblind@xxxxxxxxxxxxx
> Subject: RE: Relational Database Design Question - Category Tree
>
>
> Hi,
> I have another question about this. Does it really matter which
> categories
> are sub categories of others as long as you let things be in multiple
> categories?
>
> 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 11:43          Question - Category Tree
>
>              AM
>
>
>
>
>
>              Please respond to
>
>              programmingblind@
>
>                freelists.org
>
>
>
>
>
>
>
>
>
>
> Scenario 1
> I would say in that example you would have an editor category, and you
> would have 2 sub categories; text and html.
>
> Editor is the parent category .  And Text is a child of Editor, and Html
> is
> a child of Editor.
> 1 parent, 2 children.
>
> Scenario 2
> Say if you have another category called Browser, and you know there is a
> text browser and a html browser.
>
> Would you want to link the same text child and html child of Editor to
> the
> Browser category?
>
> So, in this example the end result would be:
> Editor is a parent category .  And Text is a child of Editor, and Html
> is a
> child of Editor.
> Browser is a parent category .  And Text is a child of Browser, and Html
> is
> a child of Browser.
>
> Both Editor and Browser are parents.
> Text has 2 parents (Editor and Browser).
> Html has 2 parents (Editor and Browser).
>
>
> Scenario 1 is a 1 to 1 relationship.
> Scenario 2 is a 1 to many relationship.
>
> For your project, with items, categories, and levels of subcategories:
> Scenario 1 will only need 3 tables.  But you can implement it with 4.
> Scenario 2 would require 4 tables.
>
>
>
> Thanks.
> Rodney
>
>
>
>
>
>
> -----Original Message-----
> From: programmingblind-bounce@xxxxxxxxxxxxx
> [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of
> james.homme@xxxxxxxxxxxx
> Sent: Wednesday, September 12, 2007 11:07 AM
> To: programmingblind@xxxxxxxxxxxxx
> Subject: RE: Relational Database Design Question - Category Tree
>
> 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
>
> __________
> 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
>
__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: