Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize the sql statement of cascading data of provinces and cities in mysql

2025-01-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces how to achieve the national provincial and municipal cascade data sql statement in mysql, which has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, let the editor take you to understand it.

-- Provincial provincial

Create table provincial

(

ProvincialID int

ProvincialName varchar (50)

Primary key (provincialID)

) engine=INNODB default charset=gbk

Insert into provincial values (1pm 'Beijing')

Insert into provincial values (2Jing Tianjin)

Insert into provincial values (3) 'Shanghai')

Insert into provincial values (4pm 'Chongqing')

Insert into provincial values (5pm 'Hebei')

Insert into provincial values (6) 'Shanxi Province')

Insert into provincial values (7) 'Taiwan Province')

Insert into provincial values (8) 'Liaoning Province')

Insert into provincial values (9pm 'Jilin Province')

Insert into provincial values (10) 'Heilongjiang Province')

Insert into provincial values (11pi 'Jiangsu Province')

Insert into provincial values (1214 'Zhejiang Province')

Insert into provincial values ('Anhui Province')

Insert into provincial values (14dint 'Fujian Province')

Insert into provincial values (1550 'Jiangxi Province')

Insert into provincial values (16) 'Shandong Province')

Insert into provincial values (17pi 'Henan')

Insert into provincial values (18pas' Hubei Province')

Insert into provincial values (1950 'Hunan Province')

Insert into provincial values (2010 'Guangdong Province')

Insert into provincial values (21J 'Gansu Province')

Insert into provincial values (22pi 'Sichuan Province')

Insert into provincial values (23dint 'Guizhou Province')

Insert into provincial values (24) 'Hainan Province')

Insert into provincial values (25pr 'Yunnan Province')

Insert into provincial values (26pas' Qinghai Province')

Insert into provincial values (27pas' Shaanxi Province')

Insert into provincial values (287 'Guangxi Zhuang Autonomous region')

Insert into provincial values (29Jing 'Xizang Autonomous region')

Insert into provincial values (30pm 'Ningxia Hui Autonomous region')

Insert into provincial values (31) 'Xinjiang Uygur Autonomous region')

Insert into provincial values (32) 'Inner Mongolia Autonomous region')

Insert into provincial values (33Jing 'Macao Special Administrative region')

Insert into provincial values (34th Hong Kong Special Administrative region)

Select provincialID,provincialName from provincial

-- Urban city

Create table city

(

CityID int not null

CityName varchar (50) not null

ProvincialID int not null

Primary key (cityID)

) engine=INNODB default charset=gbk

Alter table city add constraint FK_pro_city_provincialID foreign key (provincialID)

References provincial (provincialID)

- -

-- insert city data for each province

-4 municipalities directly under the Central Government

Insert into city values (1) Beijing, 1)

Insert into city values (2Jing Tianjin, 2)

Insert into city values (3 in Shanghai, 3)

Insert into city values (4pm 'Chongqing', 4)

-- select * from city where provincialID=4

-5 11 prefecture-level cities in Hebei Province

Insert into city values (5Jing 'Shijiazhuang', 5)

Insert into city values (6) 'Tangshan', 5)

Insert into city values (7) 'Qinhuangdao City', 5)

Insert into city values (8) 'Handan City', 5)

Insert into city values (9 minutes' Xingtai City', 5)

Insert into city values (10) 'Baoding', 5)

Insert into city values (11) Zhangjiakou City, 5)

Insert into city values (1250 'Chengde City', 5)

Insert into city values (13pi 'Cangzhou', 5)

Insert into city values (14) 'Langfang City', 5)

Insert into city values (1550 'Hengshui City', 5)

-- select * from city where provincialID=5 order by cityID

-- 6 11 cities in Shanxi Province

Insert into city values (16) 'Taiyuan City', 6)

Insert into city values (17, 'Datong City', 6)

Insert into city values (1850 'Yangquan City', 6)

Insert into city values (1950 'Changzhi City', 6)

Insert into city values (2050 'Jincheng', 6)

Insert into city values (21) 'Shuozhou', 6)

Insert into city values (22nd 'Jinzhong City', 6)

Insert into city values (2314 'Yuncheng', 6)

Insert into city values (24) 'Xinzhou', 6)

Insert into city values (25pi 'Linfen City', 6)

Insert into city values (26) 'Luliang City', 6)

-- select * from city where provincialID=6 order by cityID

-- 7 Taiwan Province (Taiwan's main island and Penghu have a total of 7 cities and 16 counties, of which Taipei City and Kaohsiung City are "courtyard municipalities" directly under the "Executive Yuan" and the rest belong to Taiwan Province; cities under cities and counties are divided into cities (cities under county jurisdiction), towns and townships, collectively called district cities and townships.)

Insert into city values (27 minutes' Taipei', 7)

Insert into city values (28pi Kaohsiung City, 7)

Insert into city values (29Jing 'Keelung City', 7)

Insert into city values (30 minutes' Taichung City', 7)

Insert into city values (31 Tainan City, 7)

Insert into city values (32) Hsinchu City, 7)

Insert into city values (33tech 'Chiayi City', 7)

Insert into city values (34) Taipei County, 7)

Insert into city values (35, 'Ilan County', 7)

Insert into city values (36th) Taoyuan County, 7)

Insert into city values (37) Hsinchu County, 7)

Insert into city values (38pi 'Miaoli County', 7)

Insert into city values (39) Taichung County, 7)

Insert into city values (40) 'Changhua County', 7)

Insert into city values (41) 'Nantou County', 7)

Insert into city values (42) Yunlin County, 7)

Insert into city values (43, 7, Chiayi County)

Insert into city values (44) Tainan County, 7)

Insert into city values (45) Kaohsiung County, 7)

Insert into city values (46) Pingtung County, 7)

Insert into city values (47) Penghu County, 7)

Insert into city values (48pm 'Taitung County', 7)

Insert into city values (49, 'Hualien County, 7)

-- select * from city where provincialID=7 order by cityID

-8 14 prefecture-level cities in Liaoning Province

Insert into city values (50) 'Shenyang', 8)

Insert into city values (51 Jing 'Dalian', 8)

Insert into city values (52) 'Anshan', 8)

Insert into city values (53) 'Fushun City', 8)

Insert into city values (54) 'Benxi City', 8)

Insert into city values (55pm 'Dandong', 8)

Insert into city values (56) 'Jinzhou', 8)

Insert into city values (57) Yingkou City, 8)

Insert into city values (58pm 'Fuxin City', 8)

Insert into city values ('Liaoyang', 8)

Insert into city values (60th 'Panjin City', 8)

Insert into city values (61) 'Tieling City', 8)

Insert into city values (62, Chaoyang, 8)

Insert into city values (63pm 'Huludao City', 8)

-- select * from city where provincialID=8 order by cityID

-- 9 Jilin Province (in 2006, it had jurisdiction over 8 prefecture-level cities, 1 autonomous prefecture, 20 municipal districts, 20 county-level cities, 17 counties and 3 autonomous counties.)

Insert into city values (64, 'Changchun', 9)

Insert into city values ('Jilin City', 9)

Insert into city values (6 / 6), Siping City, 9)

Insert into city values (67) Liaoyuan City, 9)

Insert into city values ('Tonghua City', 9)

Insert into city values (69) 'Baishan City', 9)

Insert into city values (70pi 'Songyuan City', 9)

Insert into city values (71 Bai Cheng, 9)

Insert into city values (72) Yanbian Korean Autonomous Prefecture, 9)

-- select * from city where provincialID=9 order by cityID

-- 10 Heilongjiang Province (in 2006, jurisdiction: 12 prefecture-level cities, 1 district; 64 municipal districts, 18 county-level cities, 45 counties, 1 autonomous county)

Insert into city values ('Harbin City', 10)

Insert into city values (74) 'Qiqihar', 10)

Insert into city values (75pm 'Hegang City', 10)

Insert into city values (76) 'Shuangyashan City', 10)

Insert into city values ('Jixi City', 10)

Insert into city values (78) 'Daqing City', 10)

Insert into city values (79) Yichun City, 10)

Insert into city values ('Mudanjiang City', 10)

Insert into city values (81 ~ 'Jiamusi City', 10)

Insert into city values (82, 'Qitaihe City, 10)

Insert into city values (83pm 'Heihe City', 10)

Insert into city values (84pm 'Suihua City', 10)

Insert into city values (85) Daxing'anling area, 10)

-- select * from city where provincialID=10 order by cityID

-11 Jiangsu Province (in 2005: 13 prefecture-level cities; 54 municipal districts, 27 county-level cities and 25 counties)

Insert into city values (86, 'Nanjing', 11)

Insert into city values (87, 'Wuxi City, 11)

Insert into city values (88pm 'Xuzhou', 11)

Insert into city values (89) 'Changzhou', 11)

Insert into city values (90th 'Suzhou', 11)

Insert into city values (91) 'Nantong City', 11)

Insert into city values ('Lianyungang City', 11)

Insert into city values (93, 'Huai'an City', 11)

Insert into city values (94) Yancheng, 11)

Insert into city values ('Yangzhou', 11)

Insert into city values (96, 'Zhenjiang City', 11)

Insert into city values (97, 'Taizhou', 11)

Insert into city values (98 'Suqian City', 11)

-- select * from city where provincialID=11 order by cityID

-- 12 Zhejiang Province (in 2006, it has jurisdiction over 11 prefecture-level cities, 32 municipal districts, 22 county-level cities, 35 counties and 1 autonomous county.)

Insert into city values (9999m 'Hangzhou', 12)

Insert into city values (100th Ningbo City, 12)

Insert into city values (101) Wenzhou, 12)

Insert into city values (102, Jiaxing City, 12)

Insert into city values (103 'Huzhou', 12)

Insert into city values (104, Shaoxing City, 12)

Insert into city values (105, 'Jinhua City', 12)

Insert into city values (106, Quzhou, 12)

Insert into city values (107, Zhoushan City, 12)

Insert into city values (108, Taizhou, 12)

Insert into city values (109) 'Lishui', 12)

-- select * from city where provincialID=12 order by cityID

-- 13 Anhui Province (jurisdiction in 2005: 17 prefecture-level cities; 44 municipal districts, 5 counties and 56 counties.)

Insert into city values (110) 'Hefei', 13)

Insert into city values (111pm 'Wuhu City', 13)

Insert into city values (112 Bengbu City, 13)

Insert into city values ('Huainan City', 13)

Insert into city values (114 Ma'anshan City, 13)

Insert into city values (115, 'Huaibei City', 13)

Insert into city values (116, 'Tongling City, 13)

Insert into city values (117, 'Anqing', 13)

Insert into city values (118, 'Huangshan City', 13)

Insert into city values (119 'Chuzhou', 13)

Insert into city values (120m 'Fuyang', 13)

Insert into city values (121 ~ 'Suzhou', 13)

Insert into city values (122, Chaohu City, 13)

Insert into city values (123'Lu'an City', 13)

Insert into city values (124, Bozhou, 13)

Insert into city values (125, 'Chizhou', 13)

Insert into city values (126, 'Xuancheng', 13)

-- select * from city where provincialID=13 order by cityID

-- 14 Fujian Province (2006: 9 prefecture-level cities; 26 municipal districts, 14 county-level cities and 45 counties.)

Insert into city values (127 'Fuzhou', 14)

Insert into city values (128, 'Xiamen', 14)

Insert into city values (129, 'Putian City', 14)

Insert into city values (130 ~ (th) 'Sanming', 14)

Insert into city values (131 ~ 'Quanzhou', 14)

Insert into city values (132 Zhangzhou, 14)

Insert into city values (133, 'Nanping City, 14)

Insert into city values (134, 'Longyan City', 14)

Insert into city values (135pm 'Ningde City', 14)

-- select * from city where provincialID=14 order by cityID

-- 15 Jiangxi Province (in 2006, the province has jurisdiction over 11 prefecture-level cities, 19 municipal districts, 10 county-level cities and 70 counties.)

Insert into city values (136, 'Nanchang City', 15)

Insert into city values (137 Jing Dezhen City, 15)

Insert into city values (138pm 'Pingxiang', 15)

Insert into city values (139, Jiujiang City, 15)

Insert into city values (140pm 'Xinyu City', 15)

Insert into city values (141pm 'Yingtan City', 15)

Insert into city values (142, Ganzhou, 15)

Insert into city values (143tech'Ji'an', 15)

Insert into city values (144pm 'Yichun City', 15)

Insert into city values (14550 'Fuzhou', 15)

Insert into city values (146century Shangrao City, 15)

-- select * from city where provincialID=15 order by cityID

-- 16 Shandong Province (in 2005, it had jurisdiction over 17 prefecture-level cities, 49 municipal districts, 31 county-level cities and 60 counties.)

Insert into city values (147 Ji'nan, 16)

Insert into city values (148pm 'Qingdao', 16)

Insert into city values (149pm Zibo City, 16)

Insert into city values (150J. 'Zaozhuang City', 16)

Insert into city values (151pm 'Dongying City', 16)

Insert into city values (152, 'Yantai City', 16)

Insert into city values (153pm 'Weifang', 16)

Insert into city values (154 Jining City, 16)

Insert into city values (155 'Taian City', 16)

Insert into city values (156, 'Weihai', 16)

Insert into city values (157, 'Rizhao City', 16)

Insert into city values (158, 'Laiwu City', 16)

Insert into city values (159) 'Linyi City', 16)

Insert into city values (160 ~ 'Dezhou', 16)

Insert into city values (161pm Liaocheng, 16)

Insert into city values (162 Binzhou, 16)

Insert into city values (163, 'Heze City', 16)

-- select * from city where provincialID=16 order by cityID

17 17 cities at the prefecture level in Henan Province

Insert into city values (164) Zhengzhou, 17)

Insert into city values (165pm 'Kaifeng', 17)

Insert into city values (166) 'Luoyang', 17)

Insert into city values (167, 'Pingdingshan City', 17)

Insert into city values (168, 'Anyang', 17)

Insert into city values (169) 'Hebi City', 17)

Insert into city values (170pm 'Xinxiang City', 17)

Insert into city values ('Jiaozuo City', 17)

Insert into city values (172, 'Puyang', 17)

Insert into city values (173, 'Xuchang City', 17)

Insert into city values (174, 'Luohe City', 17)

Insert into city values (175, 'Sanmenxia City', 17)

Insert into city values (176) 'Nanyang', 17)

Insert into city values (177pm 'Shangqiu City', 17)

Insert into city values (178) 'Xinyang', 17)

Insert into city values (179) Zhoukou City, 17)

Insert into city values (18010 'Zhumadian City', 17)

Insert into city values (181, 'Jiyuan City', 17)

-- select * from city where provincialID=17 order by cityID

-- 18 Hubei Province (as of December 31, 2005, the province has jurisdiction over 13 prefecture-level units (12 prefecture-level cities, 1 autonomous prefecture) and 102 county-level units (38 municipal districts, 24 county-level cities, 37 counties, 2 autonomous counties and 1 forest region). There are 1220 township units (277 streets, 733 towns and 210 townships). )

Insert into city values (182, 'Wuhan', 18)

Insert into city values (183, 'Huangshi City', 18)

Insert into city values (184, 'Shiyan City', 18)

Insert into city values (185 Jing Zhou, 18)

Insert into city values (186, 'Yichang City', 18)

Insert into city values (187, 'Xiangfan City', 18)

Insert into city values (188, 'Ezhou', 18)

Insert into city values (189 Jing Men City, 18)

Insert into city values (1909, 18, Xiaogan City)

Insert into city values (191pm 'Huanggang City', 18)

Insert into city values (192, 'Xianning City', 18)

Insert into city values (193pm 'Suizhou', 18)

Insert into city values (194, 'Xiantao City', 18)

Insert into city values (1951, 'Tianmen City', 18)

Insert into city values (1969 'Qianjiang City', 18)

Insert into city values ('Shennongjia Forest region', 18)

Insert into city values (19814 'Enshi Tujia and Miao Autonomous Prefecture', 18)

-- select * from city where provincialID=18 order by cityID

-19 Hunan Province (under its jurisdiction in 2005: 13 prefecture-level cities, 1 autonomous prefecture, 34 municipal districts, 16 county-level cities, 65 counties and 7 autonomous counties. )

Insert into city values (199.1 'Changsha City', 19)

Insert into city values ('Zhuzhou City', 19)

Insert into city values (20110 'Xiangtan City', 19)

Insert into city values (202) Hengyang City, 19)

Insert into city values (203 'Shaoyang', 19)

Insert into city values (204) 'Yueyang', 19)

Insert into city values (205pm 'Changde City', 19)

Insert into city values (206 Zhangjiajie City, 19)

Insert into city values (207, 'Yiyang', 19)

Insert into city values (208, 'Chenzhou', 19)

Insert into city values (209pm Yongzhou, 19)

Insert into city values (210 'Huaihua City', 19)

Insert into city values (211, 'Loudi', 19)

Insert into city values (212, 'Xiangxi Tujia and Miao Autonomous Prefecture', 19)

-- select * from city where provincialID=19 order by cityID

Guangdong Province (as of December 31, 2005, Guangdong Province has jurisdiction: 21 prefecture-level cities, 54 municipal districts, 23 county-level cities, 41 counties, 3 autonomous counties, 429 subdistrict offices, 1145 towns, 4 townships and 7 nationality townships. )

Insert into city values (213, 'Guangzhou', 20)

Insert into city values (214, 'Shenzhen', 20)

Insert into city values (215 'Zhuhai', 20)

Insert into city values (216, Shantou City, 20)

Insert into city values (217 'Shaoguan City', 20)

Insert into city values (218, 'Foshan City', 20)

Insert into city values (21919 'Jiangmen City', 20)

Insert into city values (220 Zhanjiang City, 20)

Insert into city values (221 Magi 'Maoming', 20)

Insert into city values (222 Zhaoqing, 20)

Insert into city values (223) Huizhou, 20)

Insert into city values (224) Meizhou, 20)

Insert into city values (225, 'Shanwei City', 20)

Insert into city values (226) Heyuan City, 20)

Insert into city values (227, 'Yangjiang City', 20)

Insert into city values (2286 'Qingyuan City', 20)

Insert into city values (229Jing 'Dongguan City', 20)

Insert into city values (230 'Zhongshan City', 20)

Insert into city values (231 ~ Chaozhou, 20)

Insert into city values (232, 'Jieyang', 20)

Insert into city values (233) Yunfu City, 20)

-- select * from city where provincialID=20 order by cityID

-21 12 prefecture-level cities and 2 autonomous prefectures in Gansu Province

Insert into city values (234). Lanzhou, 21)

Insert into city values (235) Jinchang City, 21)

Insert into city values (236) Baiyin City, 21)

Insert into city values (237) Tianshui City, 21)

Insert into city values (238, 21, Jiayuguan City)

Insert into city values (239) Wuwei City, 21)

Insert into city values (240 Zhangye City, 21)

Insert into city values (241) Pingliang City, 21)

Insert into city values (242, Jiuquan City, 21)

Insert into city values (243pm 'Qingyang', 21)

Insert into city values (244 Dingxi City, 21)

Insert into city values (245pm 'Longnan City', 21)

Insert into city values (246, 21, Linxia Hui Autonomous Prefecture)

Insert into city values (247) Gannan Tibetan Autonomous Prefecture, 21)

-- select * from city where provincialID=21 order by cityID

22 18 prefecture-level cities and 3 autonomous prefectures in Sichuan Province

Insert into city values (248pm Chengdu, 22)

Insert into city values (249 'Zigong City', 22)

Insert into city values (250, 'Panzhihua City', 22)

Insert into city values (251pm 'Luzhou', 22)

Insert into city values (252 'Deyang', 22)

Insert into city values (253, 'Mianyang', 22)

Insert into city values (254pm 'Guangyuan City', 22)

Insert into city values (255, 'Suining City', 22)

Insert into city values (256, 'Neijiang City', 22)

Insert into city values (257 'Leshan', 22)

Insert into city values (258 'Nanchong City', 22)

Insert into city values (259 Meishan City, 22)

Insert into city values (260th 'Yibin City', 22)

Insert into city values (261m 'Guang'an', 22)

Insert into city values (262 Dazhou, 22)

Insert into city values (263'Ya'an', 22)

Insert into city values (264 Bazhong City, 22)

Insert into city values (265) Ziyang, 22)

Insert into city values (266, 22, Aba Tibetan and Qiang Autonomous Prefecture)

Insert into city values (267, 22, Ganzi Tibetan Autonomous Prefecture)

Insert into city values (268, 22, Liangshan Yi Autonomous Prefecture)

-- select * from city where provincialID=22 order by cityID

-23 Guizhou Province (under its jurisdiction in 2006: 4 prefecture-level cities, 2 regions, 3 autonomous prefectures; 10 municipal districts, 9 county-level cities, 56 counties, 11 autonomous counties and 2 special zones.)

Insert into city values (269 'Guiyang', 23)

Insert into city values (270pm 'Liupanshui City', 23)

Insert into city values (271 Zunyi City, 23)

Insert into city values (272 'Anshun', 23)

Insert into city values (273 Tongren area, 23)

Insert into city values (274, Bijie area, 23)

Insert into city values (275pm 'Buyi and Miao Autonomous Prefecture of Southwest Guizhou', 23)

Insert into city values (276) 'Qiandongnan Miao Dong Autonomous Prefecture', 23)

Insert into city values (277), Qiannan Buyi and Miao Autonomous Prefecture, 23)

-- select * from city where provincialID=23 order by cityID

-24 Hainan Province has 2 prefecture-level cities, 6 county-level cities, 4 counties, 6 ethnic autonomous counties, 4 municipal districts and 1 office (Zhongsha Islands Office in Southwest China, county level).)

Insert into city values (278, Haikou City, 24)

Insert into city values (279, Sanya City, 24)

Insert into city values (280pm 'Wuzhishan City', 24)

Insert into city values (281pm 'Qionghai', 24)

Insert into city values (282, Danzhou, 24)

Insert into city values (283pm 'Wenchang City', 24)

Insert into city values (284pi Wanning City, 24)

Insert into city values (285pm 'Oriental City', 24)

Insert into city values (286), Chengmai County, 24)

Insert into city values (287 Ding'an County, 24)

Insert into city values (288) 'Tunchang County', 24)

Insert into city values (289pm Lingao County, 24)

Insert into city values (290pm Baisha Li Autonomous County, 24)

Insert into city values (291, 24, Changjiang Li Autonomous County)

Insert into city values (292), Ledong Li Autonomous County, 24)

Insert into city values (293), Lingshui Li Autonomous County, 24)

Insert into city values (294). Baoting Li and Miao Autonomous County, 24)

Insert into city values (295pm 'Qiongzhong Li and Miao Autonomous County', 24)

-- select * from city where provincialID=24 order by cityID

-25 Yunnan Province (under its jurisdiction in 2006: 8 prefecture-level cities and 8 autonomous prefectures; 12 municipal districts, 9 county-level cities, 79 counties and 29 autonomous counties.)

Insert into city values (296 'Kunming', 25)

Insert into city values (297 qu Jing City, 25)

Insert into city values (298 'Yuxi City', 25)

Insert into city values (299 'Baoshan', 25)

Insert into city values (300pm 'Zhaotong City', 25)

Insert into city values (301 ~ Lijiang City, 25)

Insert into city values (302 'Simao City', 25)

Insert into city values (303, 'Lincang City, 25)

Insert into city values (304, 25, Wenshan Zhuang and Miao Autonomous Prefecture)

Insert into city values (305, 25, Honghe Hani and Yi Autonomous Prefecture)

Insert into city values (306 Dai Autonomous Prefecture of Xishuangbanna, 25)

Insert into city values (307, 25, Chuxiong Yi Autonomous Prefecture)

Insert into city values (308 Bai Autonomous Prefecture of Dali, 25)

Insert into city values (309) Dehong Dai Jingpo Autonomous Prefecture, 25)

Insert into city values (310) 'Nujiang Lisu Autonomous Prefecture' 25)

Insert into city values (311, 25, Diqing Tibetan Autonomous Prefecture)

-- select * from city where provincialID=25 order by cityID

-- 26 Qinghai Province (under its jurisdiction in 2006: 1 prefecture, 1 region, 6 autonomous prefectures; 4 municipal districts, 2 county-level cities, 30 counties and 7 autonomous counties.)

Insert into city values (31210 'Xining City', 26)

Insert into city values (313pi 'Haidong area', 26)

Insert into city values (314) Haibei Tibetan Autonomous Prefecture, 26)

Insert into city values (315, 'Huangnan Tibetan Autonomous Prefecture, 26)

Insert into city values (316) Hainan Tibetan Autonomous Prefecture, 26)

Insert into city values (317, 26, Guoluo Tibetan Autonomous Prefecture)

Insert into city values (318pm 'Yushu Tibetan Autonomous Prefecture', 26)

Insert into city values (319, Haixi Mongolian and Tibetan Autonomous Prefecture, 26)

-- select * from city where provincialID=26 order by cityID

-- 27 Shaanxi Province (in 2006: 10 prefecture-level cities; 24 municipal districts, 3 county-level cities and 80 counties.)

Insert into city values (320m'Xi'an', 27)

Insert into city values (321 ~ # Tongchuan City, 27)

Insert into city values (322 Bao Ji City, 27)

Insert into city values (323) Xianyang, 27)

Insert into city values (324) Weinan City, 27)

Insert into city values (325pr 'Yan'an', 27)

Insert into city values (326) Hanzhong City, 27)

Insert into city values (327, 'Yulin City, 27)

Insert into city values ("Ankang City", 27)

Insert into city values (3296 'Shangluo City', 27)

-- select * from city where provincialID=27 order by cityID

-28 Guangxi Zhuang Autonomous region (under its jurisdiction in 2005: 14 prefecture-level cities; 34 municipal districts, 7 county-level cities, 56 counties and 12 autonomous counties.)

Insert into city values (330, 'Nanning City', 28)

Insert into city values (331 ~ Liuzhou, 28)

Insert into city values (332) Guilin City, 28)

Insert into city values (333, Wuzhou, 28)

Insert into city values (334, Beihai, 28)

Insert into city values (335) Fangchenggang City, 28)

Insert into city values (336, Qinzhou, 28)

Insert into city values (337, 'Guigang City', 28)

Insert into city values (338pm 'Yulin City', 28)

Insert into city values (339 Bose, 28)

Insert into city values (340th 'Hezhou', 28)

Insert into city values (341 ~ Hechi City, 28)

Insert into city values (342, Laibin, 28)

Insert into city values (343, 'Chongzuo City, 28)

-- select * from city where provincialID=28 order by cityID

-29 Xizang Autonomous region (jurisdiction in 2005: 1 prefecture-level city, 6 regions; 1 municipal district, 1 county-level city, 71 counties.)

Insert into city values (344 in Lhasa, 29)

Insert into city values (345 in Naqu area, 29)

Insert into city values (346, Qamdo area, 29)

Insert into city values (347 in Shannan area, 29)

Insert into city values (34850 'Xigaze region', 29)

Insert into city values (349 'Ali area', 29)

Insert into city values (350, 'Nyingchi area', 29)

-- select * from city where provincialID=29 order by cityID

-30 Ningxia Hui Autonomous region

Insert into city values (351, 'Yinchuan City', 30)

Insert into city values (352, 'Shizuishan City', 30)

Insert into city values (353 'Wuzhong City', 30)

Insert into city values (354, Guyuan City, 30)

Insert into city values (355, Zhongwei City, 30)

-- select * from city where provincialID=30 order by cityID

-- 31 Xinjiang Uygur Autonomous region (2005: 2 prefecture-level cities, 7 regions, 5 autonomous prefectures; 11 municipal districts, 20 county-level cities, 62 counties, 6 autonomous counties)

Insert into city values (356 'Urumqi', 31)

Insert into city values (357 'Karamay City', 31)

Insert into city values (358, 31, Shihezi City)

Insert into city values (359, 'Alar City', 31)

Insert into city values (360 Tumushuke City, 31)

Insert into city values (361 million 'Wujiaqu City', 31)

Insert into city values (362 Tulufan City, 31)

Insert into city values (363 'Aksu City', 31)

Insert into city values (364, Kashgar, 31)

Insert into city values (365, 'Hami City', 31)

Insert into city values (366 Hotan City, 31)

Insert into city values (367 'Atushi City', 31)

Insert into city values (368, 'Korla City', 31)

Insert into city values (369, 'Changji City', 31)

Insert into city values (370th 'Fukang City', 31)

Insert into city values (371 Mi Quan City, 31)

Insert into city values (372 Bole, 31)

Insert into city values (373, 31, Yining City)

Insert into city values (374) Kuitun City, 31)

Insert into city values (375 Tacheng, 31)

Insert into city values (376, 'Wusu City', 31)

Insert into city values (377 'Altay City', 31)

-- select * from city where provincialID=31 order by cityID

-- 32 Inner Mongolia Autonomous region (in 2006, it had jurisdiction over 9 prefecture-level cities, 3 leagues, 21 municipal districts, 11 county-level cities, 17 counties, 49 banners and 3 autonomous banners.)

Insert into city values (378, 'Hohhot', 32)

Insert into city values (379) Baotou City, 32)

Insert into city values (380th Wuhai City, 32)

Insert into city values (381) Chifeng City, 32)

Insert into city values (382) Tongliao City, 32)

Insert into city values (383, 'Ordos City', 32)

Insert into city values (384) Hulunbuir City, 32)

Insert into city values (385, 'Bayannur City', 32)

Insert into city values (386, 'Wulanchabu City', 32)

Insert into city values (387) 'Xilingole League', 32)

Insert into city values (388 ~ Xing'an, 32)

Insert into city values (389) 'Alashan League', 32)

-- select * from city where provincialID=32 order by

-33 Macao Special Administrative region

Insert into city values (390th Macao Special Administrative region, 33)

-- select * from city where provincialID=33 order by cityID

-34 the Hong Kong Special Administrative region

Insert into city values (391, 'Hong Kong Special Administrative region', 34)

-- select * from city where provincialID=34 order by cityID

-query view

Create or replace view pro_v_city

As

Select

Pro.*

Ci.cityID

Ci.cityName

From provincial as pro

Left join city as ci on pro.provincialID=ci.provincialID

Thank you for reading this article carefully. I hope the article "how to realize the national provincial and municipal cascading data sql sentence in mysql" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report