1. 程式人生 > >mysql 建立省份表 和對應的地級市表

mysql 建立省份表 和對應的地級市表

CREATE TABLE `province` (
  `id` INT(11) DEFAULT NULL,
  `name` VARCHAR(50) DEFAULT NULL
) ENGINE=INNODB DEFAULT CHARSET=utf8;

/*省份*/
insert into province values(1,'北京市'); 
insert into province values(2,'天津市'); 
insert into province values(3,'上海市'); 
insert into province values(4,'重慶市'); 
insert into province values(5,'河北省'); 

insert into province values(6,'山西省'); 
insert into province values(7,'臺灣省'); 
insert into province values(8,'遼寧省'); 
insert into province values(9,'吉林省'); 
insert into province values(10,'黑龍江省'); 
insert into province values(11,'江蘇省'); 
insert into province values(12,'浙江省'); 
insert into province values(13,'安徽省'); 

insert into province values(14,'福建省'); 
insert into province values(15,'江西省'); 
insert into province values(16,'山東省'); 
insert into province values(17,'河南省'); 
insert into province values(18,'湖北省'); 
insert into province values(19,'湖南省'); 
insert into province values(20,'廣東省'); 
insert into province values(21,'甘肅省'); 

insert into province values(22,'四川省'); 
insert into province values(23,'貴州省'); 
insert into province values(24,'海南省'); 
insert into province values(25,'雲南省'); 
insert into province values(26,'青海省'); 
insert into province values(27,'陝西省'); 
insert into province values(28,'廣西壯族自治區'); 
insert into province values(29,'西藏自治區'); 
insert into province values(30,'寧夏回族自治區'); 
insert into province values(31,'新疆維吾爾自治區'); 
insert into province values(32,'內蒙古自治區'); 
insert into province values(33,'澳門特別行政區'); 
insert into province values(34,'香港特別行政區'); 

CREATE TABLE `city` (
  `id` INT(11) DEFAULT NULL,
  `name` VARCHAR(50) DEFAULT NULL,
  `pid` INT(11) DEFAULT NULL
) ENGINE=INNODB DEFAULT CHARSET=utf8;

/*插入各個省的城市資料*/   
insert into city values(1,'北京市',1); 
insert into city values(2,'天津市',2); 
insert into city values(3,'上海市',3); 
insert into city values(4,'重慶市',4); 

/*5河北省 11個地級市*/
insert into city values(5,'石家莊市',5);   
insert into city values(6,'唐山市',5);   
insert into city values(7,'秦皇島市',5);   
insert into city values(8,'邯鄲市',5);   
insert into city values(9,'邢臺市',5);   
insert into city values(10,'保定市',5);   
insert into city values(11,'張家口市',5);   
insert into city values(12,'承德市',5);   
insert into city values(13,'滄州市',5);   
insert into city values(14,'廊坊市',5);   
insert into city values(15,'衡水市',5);

/*6山西省 11個城市*/
insert into city values(16,'太原市',6);   
insert into city values(17,'大同市',6);   
insert into city values(18,'陽泉市',6);   
insert into city values(19,'長治市',6);   
insert into city values(20,'晉城市',6);   
insert into city values(21,'朔州市',6);   
insert into city values(22,'晉中市',6);   
insert into city values(23,'運城市',6);   
insert into city values(24,'忻州市',6);   
insert into city values(25,'臨汾市',6);   
insert into city values(26,'呂梁市',6);

/*7臺灣省(臺灣本島和澎湖共設7市、16縣,其中臺北市和高雄市為“院轄市”,直屬“行政院”,其餘屬臺灣省;市下設區,縣下設市(縣轄市)、鎮、鄉,合稱區市鎮鄉。)*/
insert into city values(27,'臺北市',7);
insert into city values(28,'高雄市',7);   
insert into city values(29,'基隆市',7);   
insert into city values(30,'臺中市',7);   
insert into city values(31,'臺南市',7);   
insert into city values(32,'新竹市',7);   
insert into city values(33,'嘉義市',7);   
insert into city values(34,'臺北縣',7);   
insert into city values(35,'宜蘭縣',7);   
insert into city values(36,'桃園縣',7);   
insert into city values(37,'新竹縣',7);   
insert into city values(38,'苗栗縣',7);   
insert into city values(39,'臺中縣',7);   
insert into city values(40,'彰化縣',7);   
insert into city values(41,'南投縣',7);   
insert into city values(42,'雲林縣',7);   
insert into city values(43,'嘉義縣',7);   
insert into city values(44,'臺南縣',7);   
insert into city values(45,'高雄縣',7);   
insert into city values(46,'屏東縣',7);   
insert into city values(47,'澎湖縣',7);   
insert into city values(48,'臺東縣',7);   
insert into city values(49,'花蓮縣',7);  

/*8遼寧省 14個地級市*/
insert into city values(50,'瀋陽市',8);   
insert into city values(51,'大連市',8);   
insert into city values(52,'鞍山市',8);   
insert into city values(53,'撫順市',8);   
insert into city values(54,'本溪市',8);   
insert into city values(55,'丹東市',8);   
insert into city values(56,'錦州市',8);   
insert into city values(57,'營口市',8);   
insert into city values(58,'阜新市',8);   
insert into city values(59,'遼陽市',8);   
insert into city values(60,'盤錦市',8);   
insert into city values(61,'鐵嶺市',8);   
insert into city values(62,'朝陽市',8);   
insert into city values(63,'葫蘆島市',8);

/*9吉林省(2006年,轄:8個地級市、1個自治州;20個市轄區、20個縣級市、17個縣、3個自治縣。)*/  
insert into city values(64,'長春市',9);   
insert into city values(65,'吉林市',9);   
insert into city values(66,'四平市',9);   
insert into city values(67,'遼源市',9);   
insert into city values(68,'通化市',9);   
insert into city values(69,'白山市',9);   
insert into city values(70,'松原市',9);   
insert into city values(71,'白城市',9);   
insert into city values(72,'延邊朝鮮族自治州',9);  

/*10黑龍江省(2006年,轄:12地級市、1地區;64市轄區、18縣級市、45縣、1自治縣)*/
insert into city values(73,'哈爾濱市',10);   
insert into city values(74,'齊齊哈爾市',10);   
insert into city values(75,'鶴 崗 市',10);   
insert into city values(76,'雙鴨山市',10);   
insert into city values(77,'雞 西 市',10);   
insert into city values(78,'大 慶 市',10);   
insert into city values(79,'伊 春 市',10);   
insert into city values(80,'牡丹江市',10);   
insert into city values(81,'佳木斯市',10);   
insert into city values(82,'七臺河市',10);   
insert into city values(83,'黑 河 市',10);   
insert into city values(84,'綏 化 市',10);   
insert into city values(85,'大興安嶺地區',10);

/*11江蘇省(2005年轄:13個地級市;54個市轄區、27個縣級市、25個縣)*/
insert into city values(86,'南京市',11);   
insert into city values(87,'無錫市',11);   
insert into city values(88,'徐州市',11);   
insert into city values(89,'常州市',11);   
insert into city values(90,'蘇州市',11);   
insert into city values(91,'南通市',11);   
insert into city values(92,'連雲港市',11);   
insert into city values(93,'淮安市',11);   
insert into city values(94,'鹽城市',11);   
insert into city values(95,'揚州市',11);   
insert into city values(96,'鎮江市',11);   
insert into city values(97,'泰州市',11);   
insert into city values(98,'宿遷市',11); 

/*12浙江省(2006年,轄:11個地級市;32個市轄區、22個縣級市、35個縣、1個自治縣。)*/
insert into city values(99,'杭州市',12);   
insert into city values(100,'寧波市',12);   
insert into city values(101,'溫州市',12);   
insert into city values(102,'嘉興市',12);   
insert into city values(103,'湖州市',12);   
insert into city values(104,'紹興市',12);   
insert into city values(105,'金華市',12);   
insert into city values(106,'衢州市',12);   
insert into city values(107,'舟山市',12);   
insert into city values(108,'台州市',12);   
insert into city values(109,'麗水市',12); 

/*13安徽省(2005年轄:17個地級市;44個市轄區、5縣個級市、56個縣。)*/
insert into city values(110,'合肥市',13);   
insert into city values(111,'蕪湖市',13);   
insert into city values(112,'蚌埠市',13);   
insert into city values(113,'淮南市',13);   
insert into city values(114,'馬鞍山市',13);   
insert into city values(115,'淮北市',13);   
insert into city values(116,'銅陵市',13);   
insert into city values(117,'安慶市',13);   
insert into city values(118,'黃山市',13);   
insert into city values(119,'滁州市',13);   
insert into city values(120,'阜陽市',13);   
insert into city values(121,'宿州市',13);   
insert into city values(122,'巢湖市',13);   
insert into city values(123,'六安市',13);   
insert into city values(124,'亳州市',13);   
insert into city values(125,'池州市',13);   
insert into city values(126,'宣城市',13);

/*14福建省(2006年轄:9個地級市;26個市轄區、14個縣級市、45個縣。)*/
insert into city values(127,'福州市',14);   
insert into city values(128,'廈門市',14);   
insert into city values(129,'莆田市',14);   
insert into city values(130,'三明市',14);   
insert into city values(131,'泉州市',14);   
insert into city values(132,'漳州市',14);   
insert into city values(133,'南平市',14);   
insert into city values(134,'龍巖市',14);   
insert into city values(135,'寧德市',14);   

/*15江西省(2006年全省轄:11個地級市;19個市轄區、10個縣級市、70個縣。)*/
insert into city values(136,'南昌市',15);   
insert into city values(137,'景德鎮市',15);   
insert into city values(138,'萍鄉市',15);   
insert into city values(139,'九江市',15);   
insert into city values(140,'新餘市',15);   
insert into city values(141,'鷹潭市',15);   
insert into city values(142,'贛州市',15);   
insert into city values(143,'吉安市',15);   
insert into city values(144,'宜春市',15);   
insert into city values(145,'撫州市',15);   
insert into city values(146,'上饒市',15);   

/*16山東省(2005年,轄:17個地級市;49個市轄區、31個縣級市、60個縣。)*/
insert into city values(147,'濟南市',16);   
insert into city values(148,'青島市',16);   
insert into city values(149,'淄博市',16);   
insert into city values(150,'棗莊市',16);   
insert into city values(151,'東營市',16);   
insert into city values(152,'煙臺市',16);   
insert into city values(153,'濰坊市',16);   
insert into city values(154,'濟寧市',16);   
insert into city values(155,'泰安市',16);   
insert into city values(156,'威海市',16);   
insert into city values(157,'日照市',16);   
insert into city values(158,'萊蕪市',16);   
insert into city values(159,'臨沂市',16);   
insert into city values(160,'德州市',16);   
insert into city values(161,'聊城市',16);   
insert into city values(162,'濱州市',16);   
insert into city values(163,'菏澤市',16); 

/*17河南省 17個地級市*/
insert into city values(164,'鄭州市',17);   
insert into city values(165,'開封市',17);   
insert into city values(166,'洛陽市',17);   
insert into city values(167,'平頂山市',17);   
insert into city values(168,'安陽市',17);   
insert into city values(169,'鶴壁市',17);   
insert into city values(170,'新鄉市',17);   
insert into city values(171,'焦作市',17);   
insert into city values(172,'濮陽市',17);   
insert into city values(173,'許昌市',17);   
insert into city values(174,'漯河市',17);   
insert into city values(175,'三門峽市',17);   
insert into city values(176,'南陽市',17);   
insert into city values(177,'商丘市',17);   
insert into city values(178,'信陽市',17);   
insert into city values(179,'周口市',17);   
insert into city values(180,'駐馬店市',17);   
insert into city values(181,'濟源市',17);  

/*18湖北省(截至2005年12月31日,全省轄13個地級單位(12個地級市、1個自治州);102縣級單位(38個市轄區、24個縣級市、37個縣、2個自治縣、1個林區),共有1220個鄉級單位(277個街道、733個鎮、210個鄉))*/
insert into city values(182,'武漢市',18);   
insert into city values(183,'黃石市',18);   
insert into city values(184,'十堰市',18);   
insert into city values(185,'荊州市',18);   
insert into city values(186,'宜昌市',18);   
insert into city values(187,'襄樊市',18);   
insert into city values(188,'鄂州市',18);   
insert into city values(189,'荊門市',18);   
insert into city values(190,'孝感市',18);   
insert into city values(191,'黃岡市',18);   
insert into city values(192,'咸寧市',18);   
insert into city values(193,'隨州市',18);   
insert into city values(194,'仙桃市',18);   
insert into city values(195,'天門市',18);   
insert into city values(196,'潛江市',18);   
insert into city values(197,'神農架林區',18);   
insert into city values(198,'恩施土家族苗族自治州',18);   

/*19湖南省(2005年轄:13個地級市、1個自治州;34個市轄區、16個縣級市、65個縣、7個自治縣。)*/
insert into city values(199,'長沙市',19);   
insert into city values(200,'株洲市',19);   
insert into city values(201,'湘潭市',19);   
insert into city values(202,'衡陽市',19);   
insert into city values(203,'邵陽市',19);   
insert into city values(204,'岳陽市',19);   
insert into city values(205,'常德市',19);   
insert into city values(206,'張家界市',19);   
insert into city values(207,'益陽市',19);   
insert into city values(208,'郴州市',19);   
insert into city values(209,'永州市',19);   
insert into city values(210,'懷化市',19);   
insert into city values(211,'婁底市',19);   
insert into city values(212,'湘西土家族苗族自治州',19);  

/*20廣東省(截至2005年12月31日,廣東省轄:21個地級市,54個市轄區、23個縣級市、41個縣、3個自治縣,429個街道辦事處、1145個鎮、4個鄉、7個民族鄉。)*/
insert into city values(213,'廣州市',20);   
insert into city values(214,'深圳市',20);   
insert into city values(215,'珠海市',20);   
insert into city values(216,'汕頭市',20);   
insert into city values(217,'韶關市',20);   
insert into city values(218,'佛山市',20);   
insert into city values(219,'江門市',20);   
insert into city values(220,'湛江市',20);   
insert into city values(221,'茂名市',20);   
insert into city values(222,'肇慶市',20);   
insert into city values(223,'惠州市',20);   
insert into city values(224,'梅州市',20);   
insert into city values(225,'汕尾市',20);   
insert into city values(226,'河源市',20);   
insert into city values(227,'陽江市',20);   
insert into city values(228,'清遠市',20);   
insert into city values(229,'東莞市',20);   
insert into city values(230,'中山市',20);   
insert into city values(231,'潮州市',20);   
insert into city values(232,'揭陽市',20);   
insert into city values(233,'雲浮市',20);  

/*21甘肅省 12個地級市、2個自治州*/
insert into city values(234,'蘭州市',21);   
insert into city values(235,'金昌市',21);   
insert into city values(236,'白銀市',21);   
insert into city values(237,'天水市',21);   
insert into city values(238,'嘉峪關市',21);   
insert into city values(239,'武威市',21);   
insert into city values(240,'張掖市',21);   
insert into city values(241,'平涼市',21);   
insert into city values(242,'酒泉市',21);   
insert into city values(243,'慶陽市',21);   
insert into city values(244,'定西市',21);   
insert into city values(245,'隴南市',21);   
insert into city values(246,'臨夏回族自治州',21);   
insert into city values(247,'甘南藏族自治州',21); 

/*22四川省18個地級市、3個自治州*/
insert into city values(248,'成都市',22);   
insert into city values(249,'自貢市',22);   
insert into city values(250,'攀枝花市',22);   
insert into city values(251,'瀘州市',22);   
insert into city values(252,'德陽市',22);   
insert into city values(253,'綿陽市',22);   
insert into city values(254,'廣元市',22);   
insert into city values(255,'遂寧市',22);   
insert into city values(256,'內江市',22);   
insert into city values(257,'樂山市',22);   
insert into city values(258,'南充市',22);   
insert into city values(259,'眉山市',22);   
insert into city values(260,'宜賓市',22);   
insert into city values(261,'廣安市',22);   
insert into city values(262,'達州市',22);   
insert into city values(263,'雅安市',22);   
insert into city values(264,'巴中市',22);   
insert into city values(265,'資陽市',22);   
insert into city values(266,'阿壩藏族羌族自治州',22);   
insert into city values(267,'甘孜藏族自治州',22);   
insert into city values(268,'涼山彝族自治州',22);

/*23貴州省(2006年轄:4個地級市、2個地區、3個自治州;10個市轄區、9個縣級市、56個縣、11個自治縣、2個特區。)*/
insert into city values(269,'貴陽市',23);   
insert into city values(270,'六盤水市',23);   
insert into city values(271,'遵義市',23);   
insert into city values(272,'安順市',23);   
insert into city values(273,'銅仁地區',23);   
insert into city values(274,'畢節地區',23);   
insert into city values(275,'黔西南布依族苗族自治州',23);   
insert into city values(276,'黔東南苗族侗族自治州',23);   
insert into city values(277,'黔南布依族苗族自治州',23);   

/*24海南省全省有2個地級市,6個縣級市,4個縣,6個民族自治縣,4個市轄區,1個辦事處(西南中沙群島辦事處 ,縣級)。)*/
insert into city values(278,'海口市',24);