Best Relational DataBase Representation Of Time Bound Hierarchies

后端 未结 4 1527
温柔的废话
温柔的废话 2021-02-02 04:27

What in everyone\'s opinion is the best representation for a time-bound hierarchy in SQL?

What I mean by this is:
- On any given date you have a normal tree hierarch

4条回答
  •  醉话见心
    2021-02-02 04:53

    There are several different books of relevance here - one set is for 'temporal databases', and the other for 'hierarchical structures in RDBMS'.

    • Snodgrass "Developing Time-Oriented Applications in SQL" (PDF available online at URL)
    • Date, Darwen and Lorentzos "Temporal Data and the Relational Model"
    • Celko "Joe Celko's Trees and Hierarchies in SQL for Smarties"

    The tricky parts of your question, it seems to me, are:

    • Viewing the whole hierarchy across a date range

    • Reporting on whole sub-trees across a date range

    The other items are, if not straight-forward, then manageable using the techniques outlined in the books, and along the lines suggested in other answers. Part of the problem is understanding what those two bullet points mean. In one sense, they are 'the same'; the 'whole hierarchy' is just a special case of 'whole sub-trees'. But the deeper question is 'how do you want to demonstrate - visualize, represent - the changes in the hierarchy over time?' Are you seeking to compare the states at the start and end times, or are you seeking to see the intermediate changes too? How do you want to represent the moves of an individual within a hierarchy?

    More questions than answers - but I hope the pointers are some help.

提交回复
热议问题