Regarding tree structures and databases, there are several
solutions for representing trees in a relational database using
standard SQL.
- path enumeration
- nested sets
- adjacency lists
Here are a few articles that describe how to use these techniques:
http://www.onlamp.com/pub/a/onlamp/2004/08/05/hierarchical_sql.html
http://www.intelligententerprise.com/001020/celko.jhtml?
_requestid=327517
http://dev.mysql.com/tech-resources/articles/hierarchical-data.html
http://www.dbazine.com/oracle/or-articles/tropashko4
http://www.dbmsmag.com/9603d06.html
Also see the book "Trees and Heirarchies in SQL for Smarties" by
Joe Celko.
http://www.amazon.com/Hierarchies-Smarties-Kaufmann-Management-
Systems/dp/1558609202/
Another one that got me started:
http://www.sitepoint.com/article/hierarchical-data-database
Nick