On another thread, you asked about doing a hierarchy.
Here's a tip: One tricky aspect of a hierarchy is "how do I find all nodes that are indirectly a child of x?" There is a reasonably efficient way of doing this.
Given a table of parents and children:
CREATE TABLE ParentsChildren (parent as INTEGER, child as INTEGER, PRIMARY KEY (parent, child))
We can maintain a table of ancestors and descendants:
CREATE TABLE AncestorsDescendants (ancestor as INTEGER, descendant as INTEGER, PRIMARY KEY (ancestor, descendant))
(Yeah, those tables should both have self-referential foreign keys.)
Suppose we insert a row as such:
INSERT INTO ParentsChildren VALUES (x, y)
What we want to do is find the ancestors of x and add y as a descendant of them.
INSERT INTO AncestorsDescendants SELECT ancestor, y AS descendant FROM AncestorsDescendants WHERE descendant = x
It's that easy. Deleting a node is also simple, you just remove all references to it.
It's also trivial to prevent cycles.
Tradeoffs: Code complexity is greatly simplified because SQL sucks at tree traversal. Time and space requirements aren't bad because, in practice, trees are almost always shallow. You do need to use triggered procedures to make sure updates happen, of course.