Found in 4 comments on Hacker News
_boffin_ · 2021-06-25 · Original thread
If this topic interests people, take a look at Joe Celko's book called Trees and Hierarchies:
kevas · 2020-12-26 · Original thread
Why not add that functionality directly to SQLite via stored procs*


calpaterson · 2015-10-02 · Original thread
I don't know much about this but Joe Celko has a whole book on representing trees in SQL:

The obvious first question would be: why are you representing your data as a graph? Can you represent it better as sets of predicates (ie: relations)?

Using views should not reduce the number of queries: a view is just a query with a name. If you can do it by combining views you can do it by combining queries.

Todd · 2014-11-21 · Original thread
A good book on the subject is Joe Celko's Trees and Hierarchies in SQL for Smarties.

He spends a chapter on each of the models outlined in this post: adjacency, path, and nested set models.

Fresh book recommendations delivered straight to your inbox every Thursday.