Normalizing Tree Data

From: cr113 <cr113_at_hotmail.com>
Date: Fri, 8 Feb 2008 09:10:29 -0800 (PST)
Message-ID: <123c9c5f-3457-4f40-8926-835ccbd3a99e_at_z17g2000hsg.googlegroups.com>


What's the simplest way to set up a relationional database with tree data? I'm more interested in simplicity vs speed.

Suppose you have a tree database with 3 levels. Company-Division- Manager. Like this:

IBM
    Div-A

        Jones
        Smith
    Div-B
        Smith

Microsoft

    Div-A

        Johnson
    Div-B

        Jones
        Smith

I was going to try something like this:

Company Table

ID   Company     Data
1     IBM               -
2     Microsoft       -

Division Table
ID Division Data

3        Div-A       -
4        Div-B       -
5        Div-A       -
6        Div-B       -

Manager Table
ID Manager Data

7     Jones         -
8     Smith         -
9     Smith         -
10   Johnson     -
11   Jones         -
12   Smith         -

ID Table
ID Parent

1      *
2      *
3      1
4      1
5      2
6      2
7      3
8      3
9      4

10 5
11 6
12 6

Any help would be appreciated! Received on Fri Feb 08 2008 - 18:10:29 CET

Original text of this message