-- 更新左右值
UPDATE area SET left_num = left_num + 2 WHERE left_num > 2879;
UPDATE area SET right_num = right_num + 2 WHERE right_num > 2879;
-- 插入 '南沙区' 信息
INSERT INTO area
SELECT NULL, '南沙区', '440115', 2148, left_num + 1, left_num + 2
FROM area WHERE area_id = 2148;
-- 查看是否满足要求
SELECT c.*
FROM area AS p, area AS c
WHERE c.left_num BETWEEN p.left_num AND p.right_num
AND p.area_id = 2148;
+---------+-----------+-----------+------+----------+-----------+
| area_id | name | area_code | pid | left_num | right_num |
+---------+-----------+-----------+------+----------+-----------+
| 2148 | 广州市 | 440100 | 2147 | 2879 | 2906 |
| 3612 | 南沙区 | 440115 | 2148 | 2880 | 2881 |
| 2161 | 从化市 | 440184 | 2148 | 2882 | 2883 |
| 2160 | 增城市 | 440183 | 2148 | 2884 | 2885 |
| 2159 | 花都区 | 440114 | 2148 | 2886 | 2887 |
| 2158 | 番禺区 | 440113 | 2148 | 2888 | 2889 |
| 2157 | 黄埔区 | 440112 | 2148 | 2890 | 2891 |
| 2156 | 白云区 | 440111 | 2148 | 2892 | 2893 |
| 2154 | 天河区 | 440106 | 2148 | 2894 | 2895 |
| 2153 | 海珠区 | 440105 | 2148 | 2896 | 2897 |
| 2152 | 越秀区 | 440104 | 2148 | 2898 | 2899 |
| 2151 | 荔湾区 | 440103 | 2148 | 2900 | 2901 |
| 2150 | 东山区 | 230406 | 2148 | 2902 | 2903 |
| 2149 | 其它区 | 440189 | 2148 | 2904 | 2905 |
+---------+-----------+-----------+------+----------+-----------+