省市、区、县、镇、乡5级联动sql文件;
共74w多条记录,表结构清晰:
CREATE TABLE `position_province` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`province_id` int(11) unsigned NOT NULL COMMENT '省份id、省份编号',
`province_name` char(32) NOT NULL COMMENT '省份名称',
PRIMARY KEY (`id`),
UNIQUE KEY `provice_id` (`province_id`)
) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=utf8 COMMENT='省份数据库';
CREATE TABLE `position_city` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`province_id` int(10) unsigned NOT NULL COMMENT '地级市id',
`city_id` bigint(20) unsigned NOT NULL COMMENT '县级市id',
`city_name` char(64) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `city_id` (`city_id`),
KEY `province_id` (`province_id`),
CONSTRAINT `position_city_ibfk_1` FOREIGN KEY (`province_id`) REFERENCES `position_province` (`province_id`) ON DELETE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=346 DEFAULT CHARSET=utf8 COMMENT='县级市数据库';
CREATE TABLE `position_country` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '地级市主键ID',
`city_id` bigint(20) unsigned NOT NULL COMMENT '地级市id',
`country_id` bigint(20) unsigned NOT NULL COMMENT '县级id',
`country_name` char(64) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `county_id` (`country_id`),
KEY `city_id` (`city_id`),
CONSTRAINT `position_country_ibfk_1` FOREIGN KEY (`city_id`) REFERENCES `position_city` (`city_id`) ON DELETE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=2857 DEFAULT CHARSET=utf8 COMMENT='地区市数据库';
CREATE TABLE `position_town` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`country_id` bigint(20) unsigned NOT NULL COMMENT '县级市id',
`town_id` bigint(20) unsigned NOT NULL COMMENT '镇id',
`town_name` char(64) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `town_id` (`town_id`),
KEY `country_id` (`country_id`) USING BTREE,
CONSTRAINT `position_town_ibfk_1` FOREIGN KEY (`country_id`) REFERENCES `position_country` (`country_id`)
) ENGINE=InnoDB AUTO_INCREMENT=43855 DEFAULT CHARSET=utf8 COMMENT='镇数据库';
CREATE TABLE `position_village` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`town_id` bigint(20) unsigned NOT NULL COMMENT '镇id',
`village_id` bigint(20) unsigned NOT NULL COMMENT '村id--唯一',
`village_name` char(64) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `village_id` (`village_id`),
KEY `town_id` (`town_id`),
CONSTRAINT `position_village_ibfk_1` FOREIGN KEY (`town_id`) REFERENCES `position_town` (`town_id`) ON DELETE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=693338 DEFAULT CHARSET=utf8 COMMENT='省市县镇村数据';
1