Re: Database planning - Hierarchical problem - Help needed

From: --CELKO-- <jcelko212_at_earthlink.net>
Date: 29 Nov 2004 18:59:36 -0800
Message-ID: <18c7b3c2.0411291859.1dfc3bdc_at_posting.google.com>


0) I have a book on TREES & HIERARCHIES IN SQL you can get at www.amazon.com. There is no French translation yet, tho.

  1. You can use an Adjacency list which is made of pairs of (boss, employee). you will have to work with cursors.
  2. You can use a Path enumerations model which is made of strings that concatenate the keys into one string. The paths to Gilbert would be ('albert+chuck+eddie+gilbert') ('john+chuck+eddie+gilbert') ('albert+chuck+fred+gilbert') ('john+chuck+fred+gilbert')

I have not played with is a newer model that would express the paths by a single string with opertors inside it like this('(albert|john)+chuck+(eddie|fred)+gilbert'). The | means "or" and that they are at the same level. The + means "followed by" . This should model a lattice structure without directed cycles. I have no idea how to write code for a query yet. I have no idea how to handle a cycle.

> Albert John
> / \ /
> / \ /
> Bert Chuck
> / | \
> / | \
> / | \
> / | \
> Donna Eddie Fred
> \ /
> \ /
> \ /
> Gilbert
> Received on Tue Nov 30 2004 - 03:59:36 CET

Original text of this message