Zip Code to City/State and vice-versa in a database?

后端 未结 11 855
无人共我
无人共我 2020-12-28 11:20

I\'m new to SQL and relational databases and I have what I would imagine is a common problem.

I\'m making a website and when each user submits a post they have to pr

11条回答
  •  情歌与酒
    2020-12-28 11:27

    For US States Tables, you can use following query, assuming you have StateId and StateName in the States table and you have StateId auto increment.

    This query has 50 US States...

    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');
    

提交回复
热议问题