Re: Trees in SQL
| От | Josh Berkus |
|---|---|
| Тема | Re: Trees in SQL |
| Дата | |
| Msg-id | 200205271306.53646.josh@agliodbs.com обсуждение исходный текст |
| Ответ на | Trees in SQL (Gregory Brauer <greg@wildbrain.com>) |
| Список | pgsql-sql |
Greg, > What sort of strategies are best for storing tree structures in a > relational database, and how would one structure SQL queries to find, > say, "all of the children anywhere under this node", or to represent > the condition "if this node is a child at any depth under this other > node"? Are there good strategies for preventing cycles? Joe Celko covers this extensively in his book "SQL for Smarties." You should definitely buy it and read the two chapters on tree structures before going any further. I will be writing an article for Techdocs within the month on implementing Celko's "Linear Nested Sets Model" of trees in PostgreSQL. If you can't wait, buy the book, e-mail me, and I'll send you my notes. -- -Josh Berkus
В списке pgsql-sql по дате отправления: