我使用此页面创建了美国各州的 SQL 表:http: //www.john.geek.nz/2009/01/sql-tips-list-of-us-states/
CREATE TABLE [dbo].[UsaStates] (
[Code] CHAR (2) NOT NULL,
[Name] VARCHAR (50) NOT NULL,
CONSTRAINT [PK_UsaStates] PRIMARY KEY CLUSTERED ([Code] ASC)
);
我创建了另一个名为“NeighborStates”的 SQL 表,其中包含 2 列:State 和 NeighborState。
CREATE TABLE [dbo].[NeighborStates](
[StateCode] [char](2) NOT NULL,
[NeighborStateCode] [char](2) NOT NULL,
CONSTRAINT [PK_NeighborStates] PRIMARY KEY CLUSTERED
(
[StateCode] ASC,
[NeighborStateCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[NeighborStates] WITH CHECK ADD CONSTRAINT [FK_NeighborStates_NeighborStates_Neighbors] FOREIGN KEY([NeighborStateCode])
REFERENCES [dbo].[UsaStates] ([Code])
GO
ALTER TABLE [dbo].[NeighborStates] WITH CHECK ADD CONSTRAINT [FK_NeighborStates_UsaStates] FOREIGN KEY([StateCode])
REFERENCES [dbo].[UsaStates] ([Code])
GO
但是现在,我正在寻找一些地理空间数据,甚至是一个硬编码列表(每个州的邻国列表)来填充我的表格“NeighborStates”。
您知道在哪里可以找到与给定美国州相邻的州的数据源吗?
INSERT INTO [NeighborStates](StateCode,NeighborStateCode) ???