Is this a good way to model address information in a relational database?

前端 未结 7 2054
走了就别回头了
走了就别回头了 2020-12-02 09:35

I\'m wondering if this is a good design. I have a number of tables that require address information (e.g. street, post code/zip, country, fax, email). Sometimes the same a

7条回答
  •  情书的邮戳
    2020-12-02 10:03

    I think I agree with JohnFx..

    Another thing about (snail-)mail addresses, since you want to include country I assume you want to ship/mail internationally, please keep the address field mostly freeform text. It's really annoying having to make up an 5 digit zip code when Norway don't have zip-codes, we have 4 digit post-numbers.

    The best fields would be:

    • Name/Company
    • Address (multiline textarea)
    • Country

    This should be pretty global, if the US-postal system require zip-codes in a specific format, then include that too but make it optional unless USA is selected as country. Everyone know how to format the address in their country, so as long as you keep the linebreaks it should be okay...

提交回复
热议问题