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

前端 未结 9 1362
耶瑟儿~
耶瑟儿~ 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:18

    I know this is an extremely old topic that is already answered, but I thought that I'd throw my two cents in as well. It all depends on what your project goals and how you expect your target users to enter addresses. Ben's suggestion will allow you to parse addresses accurately, but on the other hand could make for a longer (and possibly more frustrating) user data entry process. Stephen Wrighton's suggestion is simpler, and could be easier for users to enter addresses as a result.

    I've also seen some models that simply had an "Address" column that would capture a typical street number, type, street name, unit / apartment number, etc. all in one column, while keeping City, Country, Region, etc. within other columns. Similar to Stephen's model, except Address1, Address2, and Address3 all consolidated into one column.

    My opinion is that the most flexible models tend to be those that are least restrictive, depending on your interpretation of flexible.

提交回复
热议问题