Is it a good idea to use an integer column for storing US ZIP codes in a database?

前端 未结 11 1832
余生分开走
余生分开走 2020-11-29 00:57

From first glance, it would appear I have two basic choices for storing ZIP codes in a database table:

  1. Text (probably most common), i.e. char(5) o
11条回答
  •  执念已碎
    2020-11-29 01:12

    ZIP code is really a coded namespace, if you think about it. Traditionally digits, but also a hyphen and capital letters:

    "10022-SHOE"

    http://www.saksfifthavenue.com/main/10022-shoe.jsp

    Realistically, a lot of business applications will not need to support this edge case, even if it is valid.

提交回复
热议问题