update data of 2020
This commit is contained in:
85
README.md
85
README.md
@@ -1,3 +1,33 @@
|
||||
# 2021年中国全国5级行政区划(省、市、县、镇、村)
|
||||
|
||||
* 数据来源 中华人民共和国国家统计局 http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2020/
|
||||
* 最新数据量 679237 (2020年6月30日)
|
||||
* CSV格式 area_code_2021.csv.gz
|
||||
* SQL格式 area_code_2021.sql.gz
|
||||
* JSON格式 单JSON格式太大就不生成了
|
||||
* 建议级联操作,数据量确实太大了
|
||||
* 级别
|
||||
* 1级:省、直辖市、自治区
|
||||
* 2级:地级市
|
||||
* 3级:市辖区、县(旗)、县级市、自治县(自治旗)、特区、林区
|
||||
* 4级:镇、乡、民族乡、县辖区、街道
|
||||
* 5级:村、居委会
|
||||
|
||||
|
||||

|
||||
|
||||
|
||||
## 大量村镇合并
|
||||
|
||||
例如:
|
||||
|
||||
- 山东省/青岛市/莱西市/[院上镇](http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2020/37/02/370285.html) 2019年有[103个村子](http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2019/37/02/85/370285104.html),到了2020年合并为[10个社区](http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2020/37/02/85/370285104.html),少了93个村
|
||||
- 山东省/青岛市/莱西市/[姜山镇](http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2020/37/02/370285.html) 2019年有[96个村子](http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2019/37/02/85/370285101.html),到了2020年合并为[14个社区](http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2020/37/02/85/370285101.html),少了93个村
|
||||
- 山东省/聊城市/高唐县/[杨屯镇](http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2020/37/15/371526.html) 2019年有[81个村子](http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2019/37/15/26/371526109.html),到了2020年合并为[18个社区](http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2020/37/15/26/371526109.html),少了63个村
|
||||
|
||||
|
||||
----
|
||||
|
||||
# 2020年中国全国5级行政区划(省、市、县、镇、村)
|
||||
|
||||
* 数据来源 中华人民共和国国家统计局 http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2019/
|
||||
@@ -18,6 +48,8 @@
|
||||
|
||||
- 少了1个地级市:山东省莱芜市,被济南市合并了,做大省会的意图明显,二线城市中济南落户比较明显
|
||||
|
||||
---
|
||||
|
||||
## CSV格式
|
||||
|
||||
* code,name,level,pcode
|
||||
@@ -28,10 +60,10 @@
|
||||
文本内容
|
||||
|
||||
```bash
|
||||
$ gzcat area_code_2020.csv.gz |wc -l
|
||||
704750
|
||||
$ gzcat area_code_2021.csv.gz |wc -l
|
||||
679237
|
||||
|
||||
$ gzcat area_code_2020.csv.gz |head
|
||||
$ gzcat area_code_2021.csv.gz |head
|
||||
110000000000,"北京市",1,0
|
||||
110100000000,"市辖区",2,110000000000
|
||||
110101000000,"东城区",3,110100000000
|
||||
@@ -46,39 +78,37 @@ $ gzcat area_code_2020.csv.gz |head
|
||||
|
||||
## SQL 格式
|
||||
|
||||
> $ gzcat area_code_2020.sql.gz |head -n 38
|
||||
> $ gzcat area_code_2021.sql.gz |head -n 38
|
||||
|
||||
```sql
|
||||
$ gzcat area_code_2020.sql.gz |head -n 38
|
||||
# ************************************************************
|
||||
# Sequel Pro SQL dump
|
||||
# Version 5446
|
||||
# Sequel Ace SQL dump
|
||||
# 版本号: 3024
|
||||
#
|
||||
# https://www.sequelpro.com/
|
||||
# https://github.com/sequelpro/sequelpro
|
||||
# https://sequel-ace.com/
|
||||
# https://github.com/Sequel-Ace/Sequel-Ace
|
||||
#
|
||||
# Host: 127.0.0.1 (MySQL 5.7.25)
|
||||
# Database: china_area
|
||||
# Generation Time: 2020-04-01 09:06:02 +0000
|
||||
# 主机: 127.0.0.1 (MySQL 5.7.29)
|
||||
# 数据库: china_area
|
||||
# 生成时间: 2021-04-04 07:24:01 +0000
|
||||
# ************************************************************
|
||||
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8 */;
|
||||
SET NAMES utf8mb4;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||
/*!40101 SET @OLD_SQL_MODE='NO_AUTO_VALUE_ON_ZERO', SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||
|
||||
|
||||
# Dump of table area_code_2020
|
||||
# 转储表 area_code_2021
|
||||
# ------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS `area_code_2020`;
|
||||
DROP TABLE IF EXISTS `area_code_2021`;
|
||||
|
||||
CREATE TABLE `area_code_2020` (
|
||||
CREATE TABLE `area_code_2021` (
|
||||
`code` bigint(12) unsigned NOT NULL COMMENT '区划代码',
|
||||
`name` varchar(128) NOT NULL DEFAULT '' COMMENT '名称',
|
||||
`level` tinyint(1) NOT NULL COMMENT '级别1-5,省市县镇村',
|
||||
@@ -90,22 +120,9 @@ CREATE TABLE `area_code_2020` (
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
```
|
||||
|
||||
> 创建视图area_index
|
||||
|
||||
```sql
|
||||
CREATE VIEW area_index_2020 AS
|
||||
SELECT a.code,e.name AS province,d.name AS city ,c.name AS county,b.name AS town,a.name AS villagetr
|
||||
FROM area_code_2020 a
|
||||
JOIN area_code_2020 b ON a.level=5 AND b.level=4 AND a.pcode=b.code
|
||||
JOIN area_code_2020 c ON b.pcode=c.code
|
||||
JOIN area_code_2020 d ON c.pcode=d.code
|
||||
JOIN area_code_2020 e ON d.pcode=e.code
|
||||
ORDER BY a.code
|
||||
```
|
||||
|
||||
查询几条记录
|
||||
|
||||
> SELECT * FROM area_index_2020 LIMIT 10
|
||||
> SELECT * FROM area_index_2021 LIMIT 10
|
||||
|
||||
```text
|
||||
code province city county town villagetr
|
||||
@@ -161,6 +178,6 @@ JSON格式,适合web端js加载。
|
||||
|
||||
## 文件列表
|
||||
|
||||
- area_code_2020.csv.gz
|
||||
- area_code_2020.sql.gz
|
||||
- area_code_2020.json
|
||||
- area_code_2021.csv.gz
|
||||
- area_code_2021.sql.gz
|
||||
- area_code_2021.json
|
||||
BIN
area_code_2021.csv.gz
Normal file
BIN
area_code_2021.csv.gz
Normal file
Binary file not shown.
1
area_code_2021.csv.gz.md5
Normal file
1
area_code_2021.csv.gz.md5
Normal file
@@ -0,0 +1 @@
|
||||
MD5 (area_code_2021.csv.gz) = b7d8cad1fe19c2a239c46093fb5b73cb
|
||||
1
area_code_2021.json
Normal file
1
area_code_2021.json
Normal file
File diff suppressed because one or more lines are too long
BIN
area_code_2021.sql.gz
Normal file
BIN
area_code_2021.sql.gz
Normal file
Binary file not shown.
1
area_code_2021.sql.gz.md5
Normal file
1
area_code_2021.sql.gz.md5
Normal file
@@ -0,0 +1 @@
|
||||
MD5 (area_code_2021.sql.gz) = a493d866022cc92e677c7f20bb0afe8e
|
||||
BIN
summary2021.jpg
Normal file
BIN
summary2021.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 254 KiB |
Reference in New Issue
Block a user