Trees do not really map well to relational databases.
The most obvious way of storing them is like:
Tree
ID | Parent ID | Name |
3 | 1 | Countries |
4 | 3 | Belgium |
5 | 3 | Netherlands |
6 | 3 | Germany |
7 | 5 | Business |
8 | 5 | Economy |
ID | Parent ID | Name |
3 | 1 | Countries |
4 | 3 | Belgium |
5 | 3 | Netherlands |
6 | 3 | Germany |
7 | 5 | Business |
8 | 5 | Economy |