Hierarchical Data - Nested Set Model: MySql

前端 未结 4 979
不知归路
不知归路 2020-12-16 19:18

I am just learning how to implement the Nested Set Model but still have confusion with a certain aspect of it involving items that may be part of multiple categories. Given

4条回答
  •  旧巷少年郎
    2020-12-16 19:29

    You do not avoid duplications and the apple (or a reference to the apple) will be placed twice in your tree otherwise it won't be a tree but rather a graph. Your question is equally applicable if you build a... Swing JTree or an HTML tree ;).

    The nested set model is just an efficient way to push and traverse a tree structure in a relational DB.It is not a data structure itself. It's more popular among MySQL users since MySQL lacks functionality for processing tree structures (e.g. like the one that Oracle provides).

    Cheers!

提交回复
热议问题