Models for Hierarchical Data in SQL and PHP
Tree-like data relationships are common, but working with trees in SQL usually requires awkward recursive queries. This talk describes alternative solutions for modeling hierarchical data that work for MySQL, including:
- Adjacency List
- Path Enumeration
- Nested Sets
- Closure Table
Code examples will demonstrate using the Closure Table in PHP, and offer guidelines for choosing one design over another.