Inheritance heirarchy - Mailing list pgsql-sql

From Jon Parise
Subject Inheritance heirarchy
Date
Msg-id 20000531150514.A25330@csh.rit.edu
Whole thread Raw
List pgsql-sql
I'm not entirely sure what the correct term for this would be, but
I'll just call it an inhertiance heirarchy for lack of a more
correct name.

Anyway, I'd like some pointers on modeling a heirarchical structure
where a given "parent" row can have multiple "children" rows, and
each "child" has either zero or one "parent"'s.  Each "child" can
also be a "parent" to many more "children".

I'll need to traverse the hierarchy from a given parent down
through its children and from a child throw all of its parents.
I'm looking to distribute a quantity of "points" from the children
back up to the parent(s) in accordance with a predefined referral
scheme.  The distribution will be based on predefined percentages
(as in, a parent receives 5% of the children's share).

I think the closest existing structure that I'm familiar with that
follows these rules would be a so-called "pyramid scam", but that
has a nasty, dubious connotation, and it's not why I'm trying to
do.

Anyway, any pointers or examples would be deeply appreciate.  I'm
not an SQL or data modeling newbie, but I'm sure you'll agree this
is a tad on the more advanced side.

Oh, and Joe Celko's book "SQL for Smarties" is already on order. =)

-- 
Jon Parise (jon@csh.rit.edu)  .  Rochester Inst. of Technology
http://www.csh.rit.edu/~jon/  :  Computer Science House Member


pgsql-sql by date:

Previous
From: Jeff MacDonald
Date:
Subject: Re: [HACKERS] Re: 7.0 weirdness
Next
From: Peter Eisentraut
Date:
Subject: Re: [ADMIN] create view security