RE: Relational Database Design Question - Category Tree

  • From: james.homme@xxxxxxxxxxxx
  • To: programmingblind@xxxxxxxxxxxxx
  • Date: Fri, 14 Sep 2007 08:25:51 -0400

Hi,
I have a little project in mind.

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."



                                                                           
             "Jamal Mazrui"                                                
             <empower@xxxxxxxx                                             
             t>                                                         To 
             Sent by:                  programmingblind@xxxxxxxxxxxxx      
             programmingblind-                                          cc 
             bounce@freelists.                                             
             org                                                   Subject 
                                       RE: Relational Database Design      
                                       Question - Category Tree            
             09/14/2007 08:00                                              
             AM                                                            
                                                                           
                                                                           
             Please respond to                                             
             programmingblind@                                             
               freelists.org                                               
                                                                           
                                                                           




Learning concepts is good, but I think the best way to learn is through
a combination of study and practice with a project of personal interest.
 If one reads a book without applying the knowledge right away, the
concepts often remain abstract and elusive when one later tries to code
them.  A small project, preferably one of passionate interest, helps
motivate one to learn concepts as needed and experience them in syntax,
debugging, and program behavior, thus leading to a firmer and more
productive grasp of them.

Just my perspective on this.
Jamal
On Thu, 13 Sep 2007 james.homme@xxxxxxxxxxxx
wrote:

> Date: Thu, 13 Sep 2007 12:35:20 -0400
> From: james.homme@xxxxxxxxxxxx
> Reply-To: programmingblind@xxxxxxxxxxxxx
> To: programmingblind@xxxxxxxxxxxxx
> Subject: RE: Relational Database Design Question - Category Tree
>
> Hi Sina,
> I fully mean to plan it out. That's the first thing I want to learn to
do.
> I don't want to write any code until I understand what the thing is going
> to look and act like as much as I can.  That's why I said I wanted to
save
> the SQL for later in the first message of the thread.
>
> Have you found some useful resources that start at the beginning?
>
> 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."
>
>
>
>
>              "Sina Bahram"
>              <sbahram@xxxxxxxx
>              m>
To
>              Sent by:                  programmingblind@xxxxxxxxxxxxx
>              programmingblind-
cc
>              bounce@freelists.
>              org
Subject
>                                        RE: Relational Database Design
>                                        Question - Category Tree
>              09/13/2007 09:06
>              AM
>
>
>              Please respond to
>              programmingblind@
>                freelists.org
>
>
>
>
>
>
> If you don't understand entity relationship diagrams, and schemas of
> databases, then you're simply coding yourself up for failure.
>
> The diagrams themselves aren't important, but the design steps are, and
it
> seems you want to jump to simply making the databases, rather than
planning
> it out.
>
> Take care,
> Sina
>
> -----Original Message-----
> From: programmingblind-bounce@xxxxxxxxxxxxx
> [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of
> james.homme@xxxxxxxxxxxx
> Sent: Thursday, September 13, 2007 7:27 AM
> To: programmingblind@xxxxxxxxxxxxx
> Subject: RE: Relational Database Design Question - Category Tree
>
> Hi,
> Time to get an SQL book. Has anyone here read Database Design For Mere
> Mortals? How did you like it? What other database design books are good?
> One of my concerns is that they usually talk all about the stupid
diagrams
> you have to make and read and not about the concepts. I want to
understand
> the kinds of relationships you can make and how to query and get what I
> want
> out of the database.
>
> Thanks for any and all help.
>
> 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."
>
>
>
>
>              "Humberto
>              Rodriguez"
>              <sub@hrfinancial.
To
>              com>                      programmingblind@xxxxxxxxxxxxx
>              Sent by:
cc
>              programmingblind-
>              bounce@freelists.
Subject
>              org                       RE: Relational Database Design
>                                        Question - Category Tree
>
>              09/12/2007 06:17
>              PM
>
>
>              Please respond to
>              programmingblind@
>                freelists.org
>
>
>
>
>
>
> 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
>
> __________
> 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: