EmergencyEMERGENCY? Get 24/7 Help Now!
  Wednesday, December 31, 1969

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.

Bill Karwin
Senior Knowledge Manager
Bill Karwin has been a software engineer for over twenty years, developing and supporting applications, libraries, and servers such as Zend Framework for PHP 5, the InterBase relational database, and the Enhydra Java application server. Throughout his career, Bill has shared his knowledge to help other programmers achieve success and productivity. Bill has answered thousands of questions, giving him a unique perspective on SQL mistakes that most commonly cause problems. Bill authored the book "SQL Antipatterns", collecting frequent blunders and showing better solutions.


General Inquiries

For general inquiries, please send us your question and someone will contact you.