How would you store a zip code in a database?
-
Hello fellow developers! In the office we got into a discussion on how you should store a zip code in a database. In Denmark zip codes are just 4-digit numbers like: 8340 or 6400. Would you store them as strings or would you store them as integers? Regards Soeren
-
Hello fellow developers! In the office we got into a discussion on how you should store a zip code in a database. In Denmark zip codes are just 4-digit numbers like: 8340 or 6400. Would you store them as strings or would you store them as integers? Regards Soeren
If there is an even remotely risk that the system at any time needs to store addresses outside of Denmark, I would store them as strings. Some countries have letters in the zip codes, swedish zip codes are five digits but they are written with a space between the third and fourth digit. --- b { font-weight: normal; }