是否有机器可读形式的美国国家公开名单?

时间:2009-01-31 13:23:14

标签: sql csv list lookup

在哪里可以找到导入我数据库的表单中的美国国家/地区列表?

SQL是理想的,否则CSV或其他平面文件格式都可以。

编辑:填写两个字母的州代码

11 个答案:

答案 0 :(得分:18)

几个星期前我需要这个,并把它作为SQL和Tab Delimited放在我的博客上。这些数据是在1月初从维基百科获得的,所以应该是最新的。

美国各州:http://www.john.geek.nz/index.php/2009/01/sql-tips-list-of-us-states/

如果我需要添加列或删除某些字段,我会使用Worlds Simplest Code Generator - http://secretgeek.net/wscg.asp

我也做了世界各国和国际拨号代码。
国家:http://www.john.geek.nz/index.php/2009/01/sql-tips-list-of-countries/
IDC:http://www.john.geek.nz/index.php/2009/01/sql-tips-list-of-international-dialling-codes-idcs/

修改:新:Towns and cities of New Zealand

答案 1 :(得分:16)

根据您需要状态的原因,值得记住的是,有超过50个有效状态代码。对于在美国境外部署的人来说,遇到不允许使用完全有效的状态代码(如AE和AP)进行地址输入的网站是很烦人的。更好的资源是USPS

答案 2 :(得分:7)

将这些剪切/粘贴到记事本中然后导入..应该很容易 - 毕竟只有50个:

 Alabama
 Alaska
 Arizona
 Arkansas
 California
 Colorado
 Connecticut
 Delaware
 Florida
 Georgia
 Hawaii
 Idaho
 Illinois
 Indiana
 Iowa
 Kansas
 Kentucky
 Louisiana
 Maine
 Maryland
 Massachusetts
 Michigan
 Minnesota
 Mississippi
 Missouri
 Montana
 Nebraska
 Nevada
 New Hampshire
 New Jersey
 New Mexico
 New York
 North Carolina
 North Dakota
 Ohio
 Oklahoma
 Oregon
 Pennsylvania
 Rhode Island
 South Carolina
 South Dakota
 Tennessee
 Texas
 Utah
 Vermont
 Virginia
 Washington
 West Virginia
 Wisconsin
 Wyoming

答案 3 :(得分:6)

出于兴趣:由于只有50个并且它们很少更改,您不能只是手动创建这样的列表from a source并将其放在公共网站空间上吗?

答案 4 :(得分:3)

为了回应@ cspoe7的敏锐观察,这里是根据USPS查询所有有效状态及其缩写。我按类别(美国官方州,哥伦比亚特区,美国领土,军事“州”)按类别排序,然后按字母顺序排列。

INSERT INTO State (Name, Abbreviation)
VALUES
('Alabama','AL'), -- States
('Alaska','AK'),
('Arizona','AZ'),
('Arkansas','AR'),
('California','CA'),
('Colorado','CO'),
('Connecticut','CT'),
('Delaware','DE'),
('Florida','FL'),
('Georgia','GA'),
('Hawaii','HI'),
('Idaho','ID'),
('Illinois','IL'),
('Indiana','IN'),
('Iowa','IA'),
('Kansas','KS'),
('Kentucky','KY'),
('Louisiana','LA'),
('Maine','ME'),
('Maryland','MD'),
('Massachusetts','MA'),
('Michigan','MI'),
('Minnesota','MN'),
('Mississippi','MS'),
('Missouri','MO'),
('Montana','MT'),
('Nebraska','NE'),
('Nevada','NV'),
('New Hampshire','NH'),
('New Jersey','NJ'),
('New Mexico','NM'),
('New York','NY'),
('North Carolina','NC'),
('North Dakota','ND'),
('Ohio','OH'),
('Oklahoma','OK'),
('Oregon','OR'),
('Pennsylvania','PA'),
('Rhode Island','RI'),
('South Carolina','SC'),
('South Dakota','SD'),
('Tennessee','TN'),
('Texas','TX'),
('Utah','UT'),
('Vermont','VT'),
('Virginia','VA'),
('Washington','WA'),
('West Virginia','WV'),
('Wisconsin','WI'),
('Wyoming','WY'),
('District of Columbia','DC'),
('American Samoa','AS'), -- Territories
('Federated States of Micronesia','FM'),
('Marshall Islands','MH'),
('Northern Mariana Islands','MP'),
('Palau','PW'),
('Puerto Rico','PR'),
('Virgin Islands','VI'),
('Armed Forces Africa','AE'), -- Armed Forces
('Armed Forces Americas','AA'),
('Armed Forces Canada','AE'),
('Armed Forces Europe','AE'),
('Armed Forces Middle East','AE'),
('Armed Forces Pacific','AP')

答案 5 :(得分:1)

如果你需要记住它们,let Wakko help you:)

答案 6 :(得分:1)

您可以在http://www.freebase.com/下载大量列表。

答案 7 :(得分:0)

http://www.geonames.org/export/

GeoNames地理数据库可以根据创意共享归属许可免费下载。它包含超过八百万个地名,包含650万个独特的功能,其中220万个人口稠密的地方和180万个备用名称。所有要素都分为九个要素类中的一个,并进一步细分为645个要素代码中的一个。 (更多统计数据......)。 可以通过许多Web服务和每日数据库导出免费访问数据。

答案 8 :(得分:0)

您可以使用google sets列出所有州以及更多或更少的列表。

答案 9 :(得分:0)

如果只需要52个状态的SQL server脚本,则可以使用以下查询:solve

INSERT INTO
 States ( StateName )
VALUES
    ( 'Alabama'),
    ( 'Alaska'),
    ( 'Arizona'),
    ( 'Arkansas'),
    ( 'California'),
    ( 'Colorado'),
    ( 'Connecticut'),
    ( 'Delaware'),
    ( 'District of Columbia'),
    ( 'Florida'),
    ( 'Georgia'),
    ( 'Hawaii'),
    ( 'Idaho'),
    ( 'Illinois'),
    ( 'Indiana'),
    ( 'Iowa'),
    ( 'Kansas'),
    ( 'Kentucky'),
    ( 'Louisiana'),
    ( 'Maine'),
    ( 'Maryland'),
    ( 'Massachusetts'),
    ( 'Michigan'),
    ( 'Minnesota'),
    ( 'Mississippi'),
    ( 'Missouri'),
    ( 'Montana'),
    ( 'Nebraska'),
    ( 'Nevada'),
    ( 'New Hampshire'),
    ( 'New Jersey'),
    ( 'New Mexico'),
    ( 'New York'),
    ( 'North Carolina'),
    ( 'North Dakota'),
    ( 'Ohio'),
    ( 'Oklahoma'),
    ( 'Oregon'),
    ( 'Pennsylvania'),
    ( 'Puerto Rico'),
    ( 'Rhode Island'),
    ( 'South Carolina'),
    ( 'South Dakota'),
    ( 'Tennessee'),
    ( 'Texas'),
    ( 'Utah'),
    ( 'Vermont'),
    ( 'Virginia'),
    ( 'Washington'),
    ( 'West Virginia'),
    ( 'Wisconsin'),
    ( 'Wyoming');

答案 10 :(得分:-1)

我要把这个美国bash / linux格式的列表放在这里,这样我可以节省一些时间:

alabama|alaska|arizona|arkansas|california|colorado|connecticut|delaware|florida|georgia|hawaii|idaho|illinois|indiana|iowa|kansas|kentucky|louisiana|maine|maryland|massachusetts|michigan|minnesota|mississippi|missouri|montana|nebraska|nevada|newhampshire|newjersey|newmexico|newyork|northcarolina|northdakota|ohio|oklahoma|oregon|pennsylvania|rhodeisland|southcarolina|southdakota|tennessee|texas|utah|vermont|virginia|washington|westvirginia|wisconsin|wyoming