A
A
AJ2013-01-22 13:25:39
Web development
AJ, 2013-01-22 13:25:39

The ideal principle of category dependency?

Good, people.
The thing has come. It is necessary to organize categories of unlimited nesting. Basically, a standard feature in many engines. But here questions of the organization of such in bases meet different.
In general, in order not to waste too much time, I got into the engines to see how smart people are doing. And a little freaked out. Everywhere is different. Some have it all in one table. In the other, everything lies in one, except for dependencies with parents. This has been moved to a separate . In the third, everything is divided into 5 tables. In general, it was not possible to come to an unambiguous decision in any way.
I see everything as rather trivial. Three columns. Category ID, Parent ID, Category Name. If the parent ID is 0, then it is the root. If not, we build a tree, going up.
But I'm not a mega guru. I admit that I did not take into account something. Hence the question: what form of building dependencies among categories is the most appropriate?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
4
4dmonster, 2013-01-22
@4dmonster

It all depends on what requests will be and to what proportions. How often the dependency network changes.

V
VeMax, 2013-01-22
@VeMax

I advise you to familiarize yourself with some hierarchical structures and only then choose. In some cases, it is convenient to use combined options.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question