Re: Working with U.S. Zip Codes

From: Dan Nelson <dan_at_dan.emsphone.com>
Date: 1996/04/24
Message-ID: <4llt5c$d0i_at_client1.news.psi.net>#1/1


Jessica <je8468a_at_american.edu> wrote:
> I am currently working on an application (to be run under an ORACLE7
> database) which requires me to find the state for a specific U.S. zip
> code.
>
> I've already downloaded a list of all U.S. zip codes from a web site and
> have stored it in a base table. The list has over 33,000 entries of zip
> codes, cities, and states. But rather than having to search the entire
> table each time, I'm wondering if anyone is aware of a more optimal
> solution for such task.
>
> I was told by someone that using the first 3 digits of the zip code, one
> could find the state in which the zip code resides. Is this actually
> true? If it is, this would probably reduce the list to < 1,000 entries.

If all you need is the state, take advantage of the fact that ZIP codes are assigned in ranges. Here's a table I built in ~10 mins from a USPS database of city/state/zip entries. Note that there are multiple groups for one state (CT, for example is split by NY's 06390 ZIP).

	-Dan Nelson
	dan_at_dan.emsphone.com

00401 00544 NY
00601 00795 PR
00801 00851 VI
00901 00999 PR
01001 02791 MA
02801 02940 RI
03031 03897 NH
03901 04992 ME
05001 05495 VT
05501 05544 MA
05601 05907 VT
06001 06389 CT
06390 06390 NY
06401 06928 CT
07001 08989 NJ
09007 09894 AE
10001 14975 NY
15001 19640 PA
19701 19980 DE
20001 20099 DC
20101 20199 VA
20201 20599 DC
20601 21930 MD
22001 24658 VA
24701 26886 WV
27006 28909 NC
29001 29945 SC
30001 31999 GA
32004 33999 FL
34001 34099 AA
34201 34997 FL
35004 36925 AL
37010 38589 TN
38601 39776 MS
39901 39901 GA
40003 42788 KY
43001 45999 OH
46001 47997 IN
48001 49971 MI
50001 52809 IA
53001 54990 WI
55001 56763 MN
57001 57799 SD
58001 58856 ND
59001 59937 MT
60001 62999 IL
63001 65899 MO
66002 67954 KS
68001 69367 NE
70001 71497 LA
71601 72959 AR
73001 73199 OK
73301 73344 TX
73401 74966 OK
75001 79999 TX
80001 81658 CO
82001 83128 WY
83201 83876 ID
84001 84790 UT
85001 86556 AZ
87001 88441 NM
88510 88595 TX
88901 89883 NV
90001 96162 CA
96201 96698 AP
96701 96797 HI
96799 96799 AS
96801 96898 HI
96910 96931 GU
96940 96940 PW
96941 96944 FM
96950 96952 MP
96960 96970 MH
97001 97920 OR
98001 99403 WA
99501 99950 AK Received on Wed Apr 24 1996 - 00:00:00 CEST

Original text of this message