» Do ZIP Codes make for a good primary key in a database?

Short Answer: No

Long Answer: By definition, a primary key is a field (or group of fields) that uniquely identifies a given entity in a table. Because ZIP codes are not quite unique enough in the database, they do not make good primary keys.

Why are ZIP codes not unique enough? The USPS has duplicate ZIP codes in the data because there is sub-information that it clarifies. An example of this sub-information is the “CityType” value. This value describes the quality of the names given to a particular ZIP code and corresponding city. For example, Atlanta is commonly given the nickname ATL, which is considered “not acceptable” by the USPS. Because of this, a separate line of data is created with identical information except for what is found in the “CityType” value – which will show a D, N, or A.


In short, ZIP codes are duplicated in many cases because clarification is needed, thus making the “ZIPcode” value not a good primary key. We recommend the auto-increment syntax for MySQL or developing your own primary key field for our ZIP code data. As the uses of our product are so diverse, we do not currently offer a field for our own “in-house” primary key. For versatility in our product, our data can be easily modified on the owner’s end which can give you the ability to make a primary key.


As with all data, this ZIP code database can be combined with other databases to create one of the most useful tools in your business. Creating a foreign key in a database like “Customers” can help discover important information about your customers by ZIP codes and help you meet their needs better.


Of course there are many other uses for our product. Creating a primary key in the ZIP code database as a reference for other databases can help you optimize the use of our services.

Our Products

ZipCode Lookup


Live Chat

ZIPCODE DATA SINCE 2002

Testimonials

" zip code download has been a really terrific bargain and has allowed us to better serve our clients."

Greg Kane
GKane Design, Inc.
More customer testimonials