in reply to storing tree-like structures in tables

First I'd like to point out that as I understand your structure it is not a real tree, because (unless you forgot to mention this restriction) two different groups can belong to a same parent group.
I had some thoughts on similar problems in an access-control setting, so let me use this language and call an item "user" and a group "group" (not much of a change, is it?).
A user can belong to one or more groups and each group can belong to (and have the access rights of) one or more groups. Say antonio is in group <students> and in group <football players>. Both <students> and <football players> belong to <people>, and <people> belongs to the <universal> group. If the problem is getting all the groups antonio belongs to, you could first look for all the groups it directly belongs to and then climb on through the hierarchy. Thus, you get
antonio -> <students>, <football players>
at the next step
antonio -> <students>, <football players>, <people>
(you only consider <people> once), and finally
antonio -> <students>, <football players>, <people>, <universal>

Steps can proliferate if you have deep levels of nesting.
To improve performance during the lookup, I would create the db this way:
users:
------------------------------
| ID | name      | fields... |
------------------------------
|  1 | antonio   |           |
     ...
|________________|___________|

groups:
-------------------------------------
| ID | name             | fields... |
-------------------------------------
|  1 | students         |           |
|  2 | football players |           |
|  3 | people           |           |
|  4 | universal        |           |
     ...
|____|__________________|___________|

user_group_rel (user belongs to group)
----------------------
| ID_user | ID_group |
----------------------
| 1       | 1        |
| 1       | 2        |
    ...
|_________|__________|

group_group_rel (group inherits from group)
-------------------------------
| ID1  | ID2 ( parent group ) |
-------------------------------
| 1    | 1                    |
| 1    | 3                    |
| 1    | 4                    |
| 2    | 2                    |
| 2    | 3                    |
| 2    | 4                    |
| 3    | 3                    |
| 3    | 4                    |
      ...
|______|______________________|
Note that the group-group relationship contains all rows (n,n) and all possible group inclusions, including derived ones (e.g. <students>-><universal>).
This requires more rows to be generated, but then you can retrieve all groups a user belongs to by the one query
SELECT UNIQUE group_group_rel.ID2
  FROM group_group_rel, user_group_rel
  WHERE user_group_rel.ID_user=?
    AND user_group_rel.ID_group=group_group_rel.ID1
If you want to keep track of what group inclusions are given and what are derived, you could add a boolean column in the group_group_rel table.

Best regards

Antonio Bellezza

Update: Added explanatory remark in italics.
  • Comment on Re: storing tree-like structures in tables