This project provides data on the administrative divisions of the People's Republic of China (2015). The data was sourced from the website of the National Bureau of Statistics of China.
- The
srcdirectory contains source code for parsing, reading, and caching administrative division data. - The
databasedirectory contains the administrative division database schema documentation and all SQL script files.
- The
database/2015directory contains the general-purpose data scripts for MySQL, SQLite, and DuckDB. - The
database/2015/.rawdirectory contains raw administrative division data files collected from government agencies. - The
database/2015/mssqldirectory contains the Microsoft SQL Server data scripts. - The
database/2015/postgresdirectory contains the PostgreSQL data scripts.
- Administratives-China-Tables.md: database schema design document
- Administratives-China-Tables(mysql).sql: database schema creation script for MySQL
- Administratives-China-Tables(mssql).sql: database schema creation script for Microsoft SQL Server
- Administratives-China-Tables(postgres).sql: database schema creation script for PostgreSQL
- Administratives-China-Tables(sqlite).sql: database schema creation script for SQLite
- Administratives-China-Tables(duckdb).sql: database schema creation script for DuckDB
The data script filenames are consistent across database variants. Select the appropriate directory for your database:
-
MySQL, SQLite, and DuckDB:
database/2015 -
Microsoft SQL Server:
database/2015/mssql, whose scripts use Unicode string literals to preserve Chinese text -
PostgreSQL:
database/2015/postgres, whose scripts use quoted identifiers to preserve table and column name casing -
Administratives-China(Province-City-District).sql: data for provinces(prefectures), cities, and districts/counties
-
Administratives-China(Street)-0.sql: subdistrict and township data for the municipalities of Beijing, Tianjin, Shanghai, and Chongqing
-
Administratives-China(Street)-1.sql: subdistrict and township data for Hebei(
13), Shanxi(14), and Inner-Mongolia(15) -
Administratives-China(Street)-2.sql: subdistrict and township data for Liaoning(
21), Jilin(22), and Heilongjiang(23) -
Administratives-China(Street)-3.sql: subdistrict and township data for Jiangsu(
32), Zhejiang(33), and Anhui(34) -
Administratives-China(Street)-4.sql: subdistrict and township data for Fujian(
35), Jiangxi(36), and Shandong(37) -
Administratives-China(Street)-5.sql: subdistrict and township data for Henan(
41), Hubei(42), and Hunan(43) -
Administratives-China(Street)-6.sql: subdistrict and township data for Guangdong(
44), Guangxi(45), and Hainan(46) -
Administratives-China(Street)-7.sql: subdistrict and township data for Sichuan(
51), Guizhou(52), and Yunnan(53) -
Administratives-China(Street)-8.sql: subdistrict and township data for Shaanxi(
61), Gansu(62), and Qinghai(63) -
Administratives-China(Street)-9.sql: subdistrict and township data for Ningxia(
64), Xinjiang(65), and Xizang(54)
- Run a schema creation script to create the administrative division tables:
- MySQL: Administratives-China-Tables(mysql).sql
- Microsoft SQL Server: Administratives-China-Tables(mssql).sql
- PostgreSQL: Administratives-China-Tables(postgres).sql
- SQLite: Administratives-China-Tables(sqlite).sql
- DuckDB: Administratives-China-Tables(duckdb).sql
- Select the appropriate year's data script directory for your database:
- MySQL, SQLite, or DuckDB:
database/2015 - Microsoft SQL Server:
database/2015/mssql - PostgreSQL:
database/2015/postgres
- MySQL, SQLite, or DuckDB:
- Run
Administratives-China(Province-City-District).sqlfrom the selected directory to initialize the province (prefecture), city, and district/county data. - Run the
Administratives-China(Street)-?.sqlscripts from the same directory in sequence to create the subdistrict and township data.
Note: This project is licensed under the MIT License. Please comply with its terms.