Re: Organizations with two or more Managers

From: Mikito Harakiri <mikharakiri_at_iahu.com>
Date: Tue, 28 Dec 2004 13:52:44 -0800
Message-ID: <aMkAd.29$oQ6.110_at_news.oracle.com>


"Au Ru" <anonymous_at_discussions.microsoft.com> wrote in message news:00fd01c4ed1c$1cf0d930$a401280a_at_phx.gbl...
> In a traditional parent-child table which is self-joined,
> like a manager and employee, we would have a table such as
> this
> tableName: Employees
> employeeId int PK not null
> worksFor int null references Employees ( employeeId )
>
> This works well where an employee works for one person.
> But we are seeing today management chains where an
> employee works for multiple managers.
>
> I wonder if a decent model for this would be a 2 table
> approach with the employee table
>
> tableName: Employees
> employeeId int PK not null
> emp_last_name varchar(25)
> emp_first_name varchar(25)
> ...
>
> and
>
> tableName: ManagementChain
> employeeId not null references Employees ( employeeId )
> worksFor not null references Employees ( employeeId )
> PK (employeeId, WorksFor)
>
> Does anybody see anything wrong with this approach for
> multiple managers? Is there something that I wouldn't be
> able to do with it?

Are multiple managers exception rather than rule? Does any fortune 500 companies have organization chart that is not a tree?

Handling trees is infinetely more simple than [directed acyclic] graphs. For one thing, how would you specify a constraint that your graph is acyclic? If your graph happens to be a tree, how would you define this constraint?

Next, assume your RDBMS have SQL extensions allowing to express queries on graph (represented as adjacency list). Expect some problems. How good is the cost model? Can optimizer come up with a realistic prediction how many joins it would perform? Certainly not, as for a given program it's even impossible to tell in advance if the program going to stop at all.

Those are couple of reasons why tree encodings really shine. Received on Tue Dec 28 2004 - 22:52:44 CET

Original text of this message