Problem solve Get help with specific problems with your technologies, process and projects.

Designing a database to support a tree structure

Is it possible to design a database to support a tree structure (e.g. groups of users and groups of groups) of undefined depth and breadth where children can have many parents - without needing to resort to recursion to navigate the tree to see if a particular group is a member of some other group? I.E. using set theory and/or mathematics to calculate the relationsip between groups?

I have done this for a normal tree structure - where each branch has only one parent, but I'm stumped when it comes to having branches that are parented by more than one branch.

This seems fairly simple to me. Create one table for groups, one for members and another that describes the membership of a member or sub-group within the group(s).

It is possible that I don't understand your question, since I see it from the perspective of a particular (tricky) implementation, the rules of which are very complex and require certain exclusions that would normally be permitted. If this doesn't seem to fix your problem, please post a message in the forum and explain what details your implementation needs.

For More Information

  • What do you think about this answer? E-mail the editors at editor@searchDatabase.com with your feedback.
  • The Best Database Design Web Links: tips, tutorials, scripts, and more.
  • Have an Oracle or SQL tip to offer your fellow DBAs and developers? The best tips submitted will receive a cool prize. Submit your tip today!
  • Ask your database design -- or help out your peers by answering them -- in our live discussion forums.
  • Ask the Experts yourself: Our SQL, database design, Oracle, SQL Server, DB2, metadata, object-oriented and data warehousing gurus are waiting to answer your toughest questions.

Dig Deeper on Oracle database design and architecture

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.