MySQL RECURSIVE TREE메뉴 추출
1. 테이블, 데이터 생성 CREATE TABLE tree ( id INT NOT NULL AUTO_INCREMENT, name VARCHAR(50) NOT NULL, parent_id INT DEFAULT NULL, PRIMARY KEY (id), FOREIGN KEY (parent_id) REFERENCES tree(id) ON DELETE CASCADE ); INSERT INTO tree (name, parent_id) VALUES ('Root', NULL); INSERT INTO tree (name, parent_id) VALUES ('Child 1', 1); INSERT INTO tree (name, parent_id) VALUES ('Child 2', 1); INSERT INTO tree (n..
2023. 8. 16.