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

后端 未结 11 858
无人共我
无人共我 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:34

    If the reason for the lookup is the user's convenience, here's an alternate approach that doesn't require licensing any third-party databases:

    Just lookup the city/state from your existing name/address table, provided the zip code matches. If somebody has previously made an entry for that zip code, then you'll find the city and state from that entry. IF no previous entry exists, then worst case the user has to entry in the city and state.

    This solution assumes your need is for convenience for the user. If you are more concerned about accurate validation of city, state, zip codes then you're better off licensing a verified database.

提交回复
热议问题