Re: Tracking Record Lineage, Family, etc.



On Fri, 02 Nov 2007 13:09:19 -0700, HumanJHawkins wrote:

(snip)
This type of issue has come up repeatedly in my work, so I assume it
is not a new problem and that there may be a "best practice" for
handling it.

Can anyone offer any advice, an answer, or point me toward a place
where I may find the answer?

Hi HumanJHawkins,

It is indeed a common issue, as you are modeling a hierarchy. The most
common example of hierarchies in database literature is the work
hierarchy (Steve reports to Jack, who reports to Michelle, etc).

There are several models commonly used for representing hierarchies,
each with their pros and cons. The most common models are:
* Adjacency List Model
* Nested Sets Model
* Materialized Path Model
I'm sure that google should bring up plenty of examples of each.

Joe Celko has dedicated a complete book to the subjects of trees and
hierarchies in SQL. I haven't read it myself so I don't know if I should
recommend it or not, but now at least you know it exists. It's called,
how unorginal, "Joe Celok's Trees and Hierarchies in SQL for Smarties".

--
Hugo Kornelis, SQL Server MVP
My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
.



Relevant Pages

  • Re: Nearest Common Ancestor Report (XDb1s $1000 Challenge)
    ... only one active application (Query Analyzer). ... tempdb (used by SQL Server to store intermediate result sets) is on the ... number of rows in the things and hierarchies ...
    (comp.object)
  • Re: SQL Server 2000 - Hierarchical data - Versus - Post Relational Databases
    ... SQL Server doesn't handle hierarchies out of the box. ... The database is storing hierarchical-based data from Exchange Server, ... Messages are stored in Folders, and so the Folders Table represents another ...
    (microsoft.public.sqlserver.programming)
  • Re: DB Design Question
    ... I support the Professional Association of SQL Server and it's community of SQL Server professionals. ... Each product has some common elements and then after that each> product has different options (seperate fields represents each option). ... > Even some of the options have extra options with it. ...
    (microsoft.public.sqlserver.server)
  • Re: Moving large amount of data
    ... "Expert SQL Server 2008 Encryption" ... columns to the target tables and I don't want these overwritten. ... all the tables that the source and target have in common. ...
    (microsoft.public.sqlserver.programming)
  • Re: Java heap and big database queries
    ... However this behaviour is common to quite a lot of JDBC driver/database combinations. ... Apparently it suits common enterprise database activities. ... SQL Server with a suitable driver will stream results. ... For smallish datasets you can use SQL Server Express for free. ...
    (comp.lang.java.programmer)