Answer the question
In order to leave comments, you need to log in
How to correctly implement nesting in database?
Good time everyone!
There is a problem, I need to implement a tree in a table,
I need to make categories> subcategories-> subcategories (the level of subcategories is not limited)
I surfed the Internet and found ways to implement it, but there are not enough materials for me. and it's hard to understand,
maybe someone has experience in creating such a hierarchy - where you need to implement categories with subcategories and subcategories.
I still need to do this in laravel. Perhaps there are even libraries that can solve this problem
, since I'm only at the very bottom in data, that is, simple queries like Select * from `table` well, for example.
and here it is.
I will be grateful for your help!
Answer the question
In order to leave comments, you need to log in
(the level of subcategories is not limited)Just for this case, once upon a time they came up with a universal contraption:
Perhaps there are even librariesNo libraries are needed for this, but keep in mind that the amount of program code you can get is an order of magnitude larger than for the case with a clear fixed structure. Therefore, such architectures (when the level of subcategories is not limited) should be avoided whenever possible.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question