Dan Price (thwack) wrote,
Dan Price

  • Mood:

Tree Hierarchy

How much of a geek to I need to be to chuckle at the idea of looking for help with designing a database to store a tree hierarchy in the comp.databases.theory archive on Google Groups?

(Hint: Google shows each thread as a huge tree structure in the left frame.)

For those who think they're geeky enough to tackle this, the specific problem I'm having is with the case of a node having more than one parent. You give it a row for each parent, right? Ok, so then what if that node has children? To which row does it point to as the parent? Both? That means two rows for each child. This would quickly get out of hand, plus the duplication of data means the database isn't normalized. (Every instance of a parent somewhere should have the same children under it, so shouldn't it only need to be defined once?)

Wrap your head around that one and then get back to me. :)

(Incidentally, the Google Groups thread tree isn't vulnerable to this problem because each message only has one parent, so I'm not chuckling TOO much...)
  • Post a new comment


    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.