How should international geographical addresses be stored in a relational database?

前端 未结 9 1355
耶瑟儿~
耶瑟儿~ 2020-11-30 16:46

Given the task of storing international geographic addresses in a relational table, what is the most flexible schema? Should every part of the address be broken out into the

9条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-30 17:06

    The only way is to split them to:

    Name varchar,
    Title varchar,
    StreetAddress varchar,
    StreetAddressLine2 varchar,
    zipCode varchar,
    City varchar,
    Province varchar,
    Country lookup
    

    since almost every country has it's own standard for having address data, and evey country has a different format of zipcodes.
    You can have a small sample of problems in my post from a similiar question.

    This should not make sense to separate addresses for every country, since there are countries where you have few address conventions. Some popular conventions include not having streets in small villages, only village name and number, while streets are in larger cities’ addresses. I have learned that in Hungary’s capital – Budapest, there are few streets having the same name (you distinct them by city’s district number), while other cities does not have such addresses (someone from Hungary may actually confirm if this is true). So the total number of address formats will be numer_of_countries multiplied by number of address formats in this country… Can be done with different tables, but it will be horrible work to do.

提交回复
热议问题