Using closure tables to manage hierarchical relations in MySQL Create DB tables Create a table to represent tree nodes. CREATE TABLE `tree_node` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `data_body` text, node_deleted datetime DEFAULT NULL,