Home > Software engineering >  VB to SQL
VB to SQL

Time:11-19

Now need to build a data table (using SQL2017) tree, the basic operations of a regular tables I will a little, but the tree data table I don't know how to start, the principle of tree I figure it out, but the concrete steps didn't understand, so worried, example I also watched a few, but I don't know how to operate in the SQL, which god gave to give directions, thank you!

CodePudding user response:

Table structure requires two key fields:
The node ID
The higher the node ID
Other nodes information casually

For example,
Node ID of the superior node ID
1 the root node 0
2 secondary node 1 1
3 secondary node 2 1
4 level 3 nodes 1.1 2
5 level 3 nodes 1.2 2
6 tertiary node 2.1 3
1.2.1 5 7 4 node

This moment tree structure is stored in this list,

CodePudding user response:

Id, the parent id, through recursive loading,
  • Related