2016全图省市区最新数据库,省34个,市374个,区县2884个。鉴于网上的全图省市区、县最新数据库很多数据都不全或者已经过时、有的数据又是分为省(S_Province)、市(S_City)、区(S_District)、三个表。这样查询很不方便。现在我整理了一个最新、最全的全图省市区、县最新数据库,把它们放在一个表中并且用一个ZoneCode和ZoneLevel分别表示区域编码和级别。
这样ZoneCode下级的编码前面把所有上级的编码拼接上。
如:四川省0028,成都市00280259,高新区002802593231
ZoneLevel:省为1,市为2,区3
这样要查询某个指定区域的市区、县数据就很方便。
--查询四川省的所有市和区县
select * from Sys_Zone where ZoneCode like '0028%'
--查询四川省的所有市
select * from Sys_Zone where ZoneCode like '0028%'and ZoneLevel=2
--查询四川省的所有区县
select * from Sys_Zone where ZoneCode like '0028%'and ZoneLevel=3
--查询成都市的所有区县
select * from Sys_Zone where ZoneCode like '00280259%'
创建表:
CREATE TABLE [dbo].[Sys_Zone](
[OID] [int] primary key nonclustered,
[Name] [varchar](50) NULL,
[ParentID] [int] NULL,
[ZoneCode] [varchar](50) NULL,
[ZoneLevel] [int] NULL,
[Remark] [varchar](50) NULL
)
全国省市区、县数据采用标准sql语句的形式支持主流数据库(SQL Server、MySQL、Oracle等等)
全国省34个,市374个,区县2884个,一共有3292条数据。