pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jon Parise <jon@csh.rit.edu>
To: pgsql-sql@postgresql.org
Subject: Inheritance heirarchy
Date: Wed, 31 May 2000 15:05:15 -0400
Message-ID: <20000531150514.A25330@csh.rit.edu> (raw)

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



Message-ID: <20000531150514.A25330@csh.rit.edu>
Permalink:  ../20000531150514.A25330@csh.rit.edu/
Also on:    postgresql.org/message-id/20000531150514.A25330@csh.rit.edu

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: jon@csh.rit.edu
  Subject: Re: Inheritance heirarchy
  In-Reply-To: <20000531150514.A25330@csh.rit.edu>
  References: <20000531150514.A25330@csh.rit.edu>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox