资源描述:
《sql_数据库__省市区_数据建表和数据.》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、--表的结构areaDROPTABLEArea;CREATETABLEArea(IDintNOTNULL,AreaIDintNOTNULL,AreaNamevarchar(200)NOTNULL,FatherIDintNOTNULL,PRIMARYKEY(ID))DROPTABLECity;CREATETABLECity(IDintNOTNULL,CityIDintNOTNULL,CityNamevarchar(200)NOTNULL,FatherIDintNOTNULL,PRIMARYKEY(ID))----导出表中的数据city-----------------------------
2、-----------------------------------表的结构province--DROPTABLEProvince;CREATETABLEProvince(IDintNOTNULL,ProvinceIDintNOTNULL,ProvinceNamevarchar(200)NOTNULL,PRIMARYKEY(ID))insertProvince(ID,ProvinceID,ProvinceName)select1,,'北京市'unionselect2,,'天津市'unionselect3,,'河北省'unionselect4,,'山西省'unionselect5,,'内蒙
3、古自治区'unionselect6,,'辽宁省'unionselect7,,'吉林省'unionselect8,,'黑龙江省'unionselect9,,'上海市'unionselect10,,'江苏省'unionselect11,,'浙江省'unionselect12,,'安徽省'unionselect13,,'福建省'unionselect14,,'江西省'unionselect15,,'山东省'unionselect16,,'河南省'unionselect17,,'湖北省'unionselect18,,'湖南省'unionselect19,,'广东省'unionselect20,,'
4、广西壮族自治区'unionselect21,,'海南省'unionselect22,,'重庆市'unionselect23,,'四川省'unionselect24,,'贵州省'unionselect25,,'云南省'unionselect26,,'西藏自治区'unionselect27,,'陕西省'unionselect28,,'甘肃省'unionselect29,,'青海省'unionselect30,,'宁夏回族自治区'unionselect31,,'新疆维吾尔自治区'unionselect32,,'台湾省'unionselect33,,'香港特别行政区'unionselect34,,
5、'澳门特别行政区'INSERTCity(ID,CityID,CityName,FatherID)select1,,'市辖区',unionselect2,,'县',unionselect3,,'市辖区',unionselect4,,'县',unionselect5,,'石家庄市',unionselect6,,'唐山市',unionselect7,,'秦皇岛市',unionselect8,,'邯郸市',unionselect9,,'邢台市',unionselect10,,'保定市',unionselect11,,'张家口市',unionselect12,,'承德市',unionselect13
6、,,'沧州市',unionselect14,,'廊坊市',unionselect15,,'衡水市',unionselect16,,'太原市',unionselect17,,'大同市',unionselect18,,'阳泉市',unionselect19,,'长治市',unionselect20,,'晋城市',unionselect21,,'朔州市',unionselect22,,'晋中市',unionselect23,,'运城市',unionselect24,,'忻州市',unionselect25,,'临汾市',unionselect26,,'吕梁市',INSERTCity(ID,Cit
7、yID,CityName,FatherID)select27,,'呼和浩特市',unionselect28,,'包头市',unionselect29,,'乌海市',unionselect30,,'赤峰市',unionselect31,,'通辽市',unionselect32,,'鄂尔多斯市',unionselect33,,'呼伦贝尔市',unionselect34,,'巴彦淖尔市',unionselect35,,'乌兰察