Re: Working with U.S. Zip Codes

From: Robert Byers <rbyers_at_ix.netcom.com>
Date: 1996/04/24
Message-ID: <317e335b.2914814_at_nntp.ix.netcom.com>


On 23 Apr 1996 03:15:14 GMT, amit_at_ix.netcom.com(Amit Bansal) wrote:

>In <317AD8CF.6CB1_at_american.edu> Jessica <je8468a_at_american.edu>
>writes:
>>
>>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.
>>
>>I would appreciate any help on this from anyone doing a similar task.
>>
>>Thanks.
>>-- Kevin
>
>I am currently developing a system and storing just the first digit of the zip
>code in the states table. We use this information while entering the zip
>code for an address, but state code is entered first. I am told by my users
>that each states zip starts with a specific number ( like 9 for CA) and I am
>using that as the validation criteria. I am not sure if the reverse is true i.e
>given the first digit, if we can find the equivalent state codes. Give a call to
>Postal Services, they may have an answer.
>
>Amit Bansal

This is not a good solution. Your logic is not correct (your users are wrong). California, Washington, Hawaii, and Alaska all start with 9. See below for state zip code ranges...note that some states have two zip code ranges with APO zips in between. APOs no longer have the name of the state where the mail is shipped through.

    1 AB Alberta                   Canada T0A   T9Z  
    2 BC British Columbia          Canada V0A   V9Z  
    3 MB Manitoba                  Canada R0A   R9Z  
    4 NB New Brunswick             Canada E0A   E9Z  
    5 NF Newfoundland              Canada A0A   A9Z  
    6 NT Northwest Territory       Canada X0A   X9Z  
    7 NS Nova Scotia               Canada B0A   B9Z  
    8 ON Ontario                   Canada K0A   P9Z  
    9 PE Prince Edward Island      Canada C0A   C9Z  
   10 PQ Quebec                    Canada G0A   J9Z  
   11 SK Saskatchewan              Canada S0A   S9Z  
   12 YT Yukon Territory           Canada Y0A   Y9Z  
   13 AL Alabama                   USA    35000 36999
   14 AK Alaska                    USA    99500 99999
   15 AS American Samoa            USA    96799 96799
   16 AZ Arizona                   USA    85000 86999
   17 AR Arkansas                  USA    71600 72999
   18 CA California                USA    90000 96199
   19 CO Colorado                  USA    80000 81999
   20 CT Connecticut               USA    06000 06999
   21 DE Delaware                  USA    19700 19999
   22 DC District Of Columbia      USA    20000 20599
   23 TT Fed States Of Micronesia  USA    96941 96944
   24 FL Florida                   USA    32000 33999
   25 GA Georgia                   USA    30000 31999
   26 GU Guam                      USA    96900 96931
   27 HI Hawaii                    USA    96700 96798
   28 ID Idaho                     USA    83200 83999
   29 IL Illinois                  USA    60000 62999
   30 IN Indiana                   USA    46000 47999
   31 IA Iowa                      USA    50000 52999
   32 KS Kansas                    USA    66000 67999
   33 KY Kentucky                  USA    40000 42999
   34 LA Louisiana                 USA    70000 71599
   35 ME Maine                     USA    04000 04999
   36 CM Marianna Islands          USA    96950 96952
   37 TT Marshall Islands          USA    96960 96970
   38 MD Maryland                  USA    20600 21999
   39 MA Massachusetts             USA    01000 02799
   40 MI Michigan                  USA    48000 49999
   41 MN Minnesota                 USA    55000 56999
   42 MS Mississippi               USA    38600 39999
   43 MO Missouri                  USA    63000 65999
   44 MT Montana                   USA    59000 59999
   45 NE Nebraska                  USA    68000 69999
   46 NV Nevada                    USA    89000 89999
   47 NH New Hampshire             USA    03000 03999
   48 NJ New Jersey                USA    07000 08999
   49 NM New Mexico                USA    87000 88999
   50 NY New York                  USA    09900 14999
   51 NC North Carolina            USA    27000 28999
   52 ND North Dakota              USA    58000 58999
   53 OH Ohio                      USA    43000 45999
   54 OK Oklahoma                  USA    73000 74999
   55 OR Oregon                    USA    97000 97999
   56 TT Palau                     USA    96940 96940
   57 PA Pennsylvania              USA    15000 19699
   58 PR Puerto Rico               USA    00600 00799
   59 RI Rhode Island              USA    02800 02999
   60 SC South Carolina            USA    29000 29999
   61 SD South Dakota              USA    57000 57999
   62 TN Tennessee                 USA    37000 38599
   63 TX Texas                     USA    75000 79999
   64 UT Utah                      USA    84000 84999
   65 VT Vermont                   USA    05000 05999
   66 VI Virgin Islands            USA    00800 00899
   67 VA Virginia                  USA    22000 24699
   68 WA Washington                USA    98000 99499
   69 WV West Virginia             USA    24700 26999
   70 WI Wisconsin                 USA    53000 54999
   71 WY Wyoming                   USA    82000 83199
   72 AE Military Post Office      USA    09000 09899
   73 FL Florida                   USA    34100 34999
   74 AA Military Post Office      USA    34000 34099
   75 AP Military Post Office      USA    96200 96699
   76 PR Puerto Rico               USA    00900 00999
   77 HI Hawaii                    USA    96800 96899
Received on Wed Apr 24 1996 - 00:00:00 CEST

Original text of this message