There is a table with the fields id, pid, name. Data from this table is displayed by nesting levels depending on the pid value.
If pid = 0, then this is the first level data. Further, each value of the first level is branched into subgroups of values of the second level, which differ in different pid = 3, 8, 26, 32, etc.
The second level is branched into the third level, here the data is also respectively grouped by pid values.
How is such a table administered? According to what principle are the pid values assigned if you need to add a new value, say, for the second or third level?