Note that there are some explanatory texts on larger screens.

plurals
  1. POBest Relational DataBase Representation Of Time Bound Hierarchies
    primarykey
    data
    text
    <p>What in everyone's opinion is the best representation for a time-bound hierarchy in SQL?</p> <p>What I mean by this is:<br> - On any given date you have a normal tree hierarchy<br> - This hierarchy can change from day to date<br> - Each child still only has one parent on any given date </p> <p>Day 1...</p> <pre><code>Business | |-Joe | |-Happy | |-Sneezy | |-Doc(*) | |-Moe |-Bashfull |-Sleepy </code></pre> <p>Day 2...</p> <pre><code>Business | |-Joe | |-Happy | |-Sneezy | |-Moe |-Doc(*) |-Bashfull |-Sleepy </code></pre> <p>At any time, a child can join the hierarchy for the first time, or leave the hierarchy completely. (For example, new employees, and retired employees.)</p> <p>The main considerations: </p> <ul> <li>Updating the hierarchy </li> <li>Viewing the whole hierarchy across a date range </li> <li>Reporting on whole sub-trees within the hierarchy </li> <li>Reporting on whole sub-trees across a date range </li> </ul> <p>I know how I do it at present, but am intrigued as to how other people may do it :)</p> <p><strong>EDIT</strong></p> <p>I naively assumed a few considerations so will be more explicit... </p> <ul> <li>Each 'team' or 'person' will have a unique ID in a dimension table elsewhere </li> <li>Other fact tables will use those IDs (storing performance metrics, for example) </li> <li>The structure needs to facilitate historical reporting across date ranges </li> <li>Use of ETL or triggers to maintain alternative structures Is an option </li> </ul> <p>The generic nature is most important (forming just one part of a generic relational mode), combined with ease of use for driving report (for any part of the tree across any range of dates) and the ability to be updated reliably.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload