Troy Pacheco
Troy Pacheco

Reputation: 21

What is the right Data Type for postal Code?

Thank you in advance. I need this for our Thesis that will be Defended on August. Please

Upvotes: 1

Views: 13129

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1269763

The right data type for a postal code is a string. In a SQL database, this would typically be VARCHAR() or CHAR(), of the appropriate length.

A numeric data type is not appropriate even if the values look like a number. Here is one simple reason: you cannot perform arithmetic on them. In addition, leading zeros are important.

Upvotes: 1

Related Questions