Skip to content
HomeVideosBooks
AllTopicsTrends
BlogsPodcasts
HistoryListsWatch laterLiked videosFollowing

The videos, books, blogs and podcasts Hacker News keeps recommending, all in one place.

VideosBooksBlogsPodcastsAboutPrivacySettings

Data from Hacker News, HackerTube, HackerBooks, HackerBlogs and Open Library. Credits · Not affiliated with Y Combinator.

HomeVideosBooksBlogsPodcasts
Ctrl K
    Cover of Joe Celko's Trees and Hierarchies in SQL for Smarties,

    Joe Celko's Trees and Hierarchies in SQL for Smarties,

    Joe Celko · 2004

    Systems & OS
    Open LibraryAmazon
    Stats for nerds
    5recommend
    6mentions
    6people
    2013–2025years
    83% recommend17% neutral

    Mentions per year

    2013201520172019202120232025

    What Hacker News says

    1. sargstuffDec 2023
      goal directed programming is the related non-sql programming paradigm. unicorn/icon[1]

      ----

      Use cases:[2]

      autoparts inventory (book keeping page statics of sales/sales person, parts, inventory on hand, etc)

      internet statistics for through put on all interfaces on group of servers [0]

      --- topic related books:

      Joe Celko has book series 'SQL for Smarties' that covers basic through advanced aggrecation with sql using example queries.

      Joe Celko's 'Trees and Hierarchies in SQL for Smarties' covers some of the ideas related to 'SQL statment returned a database'?

      ---

      [0]: https://dba.stackexchange.com/questions/173044/nested-aggreg...

      [1] : http://unicon.org/

      [2] : https://cs.uwaterloo.ca/~tozsu/courses/CS338/lectures/6%20Ne...

      thread
    2. osxmanFeb 2017
      Joe Celko's Trees and Hierarchies in SQL for Smarties (book) is a good start for better understanding/defining trees. http://a.co/9eVzvji
      thread
    3. sitkackDec 2016
      There is an excellent book on this subject, "Joe Celko's Trees and Hierarchies in SQL for Smarties".
      thread
    4. ToddNov 2014
      A good book on the subject is Joe Celko's Trees and Hierarchies in SQL for Smarties.

      http://www.amazon.com/Hierarchies-Smarties-Edition-Kaufmann-...

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

      thread
    5. jamesmiller5May 2013
      For those interested in sharpening their SQL skills I have found these two books to be a great resource.

      1. Joe Celko's Trees and Hierarchies in SQL for Smarties 2. Joe Celko's Thinking in Sets: Auxiliary, Temporal, and Virtual Tables in SQL

      thread
    6. sgarlandMay 2025
      > For example, to store a graph in a RDBMS, the ideal format is probably an adjacency list with a recursive query to iterate it

      I know this was a minor point, but I think it speaks to the overall topic, so I'll poke at it.

      Adjacency lists are perhaps the worst way to store a graph / tree in RDBMS. They may be the easiest to understand, but they have some of the worst performance characteristics, especially if your RDBMS doesn't have Recursive CTEs. This starts to matter at a much lower scale than you might think; several million rows is enough to start showing slowdowns.

      This book [0] (Joe Celko's Trees and Hierarchies in SQL For Smarties) shows many other options, though it does lack the closure table approach [1], which is my preferred approach.

      And here, we come full circle back to the long-held friction between DBs and applications. You start mentioning triggers, and devs flinch, stating that they don't want logic in the DB. In every case I've ever seen, the replacements they come up with is incredibly convoluted and prone to errors, but hey, it's not in the DB. There is no reason to fear triggers, if and only if you treat them the same way that you'd treat code (because it is): added/modified/removed only via PRs, with careful review and testing.

      [0]: https://ia804505.us.archive.org/19/items/0411-pdf-celko-tree...

      [1]: https://dirtsimple.org/2010/11/simplest-way-to-do-tree-based...

      thread

    Related

    Cover of SQL Design Patterns
    2015–2018

    SQL Design Patterns

    Vadim Tropashko
    2 recommend · 3
    Open Data StructuresPat Morin
    2012–2024

    Open Data Structures

    Pat Morin
    11 recommend · 12
    Cover of Joe Celko's SQL for Smarties
    2009–2020

    Joe Celko's SQL for Smarties

    Joe Celko
    10 recommend · 13
    Cover of SQL and relational theory
    2010–2020

    SQL and relational theory

    C. J. Date
    9 recommend · 17
    Cover of SQL puzzles & answers
    2009–2023

    SQL puzzles & answers

    Joe Celko
    3 recommend · 4
    Cover of An introduction to database systems
    2009–2024

    An introduction to database systems

    C. J. Date
    14 recommend · 35
    The Art of PostgreSQLDimitri Fontaine
    2019–2026

    The Art of PostgreSQL

    Dimitri Fontaine
    20 recommend · 25
    Cover of Database systems
    2010–2026

    Database systems

    Hector Garcia-Molina
    11 recommend · 19