What is the best column type for a United States ZIP code?

前端 未结 4 1117
北荒
北荒 2021-02-19 07:12

I want to store Zip Code (within United States) in MySQL database. Saving space is a priority. which is better option using VARCHAR - limited

4条回答
  •  遇见更好的自我
    2021-02-19 07:28

    I would suggest, use VARCHAR data type because in some countries zip codes are used as alphanumeric and in other places as an integer. So we cannot use an integer for global use. Also, zip code may start with zero like 001101 so in this case if we take data type integer then leading zero will be lost so we cannot pass actual zip code.

提交回复
热议问题