1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
DROP TABLE IF EXISTS `tree`; CREATE TABLE `tree` ( `id` int NOT NULL, `p_id` int DEFAULT NULL, `name` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
BEGIN; INSERT INTO `tree` VALUES (1, NULL, 'A'); INSERT INTO `tree` VALUES (2, NULL, 'B'); INSERT INTO `tree` VALUES (3, 1, 'A3'); INSERT INTO `tree` VALUES (4, 1, 'A4'); INSERT INTO `tree` VALUES (5, 2, 'B5'); INSERT INTO `tree` VALUES (6, 2, 'B6'); INSERT INTO `tree` VALUES (7, 2, 'B7'); INSERT INTO `tree` VALUES (8, 3, 'A3-8'); INSERT INTO `tree` VALUES (9, 3, 'A3-9'); INSERT INTO `tree` VALUES (10, 3, 'A3-10'); INSERT INTO `tree` VALUES (11, 4, 'A4-11'); INSERT INTO `tree` VALUES (12, 4, 'A4-12'); INSERT INTO `tree` VALUES (13, 6, 'B6-13'); COMMIT;
SET FOREIGN_KEY_CHECKS = 1;
|