How to represent a data tree in SQL?

后端 未结 8 865
星月不相逢
星月不相逢 2020-12-02 06:20

I\'m writing a data tree structure that is combined from a Tree and a TreeNode. Tree will contain the root and the top level actions on the data. I\'m using a UI library to

8条回答
  •  北荒
    北荒 (楼主)
    2020-12-02 06:52

    Something like table "nodes" where each node row contains parent id (in addition to the ordinary node data). For root, the parent is NULL.

    Of course, this makes finding children a bit more time consuming, but this way the actual database will be quite simple.

提交回复
热议问题