Free Zip Code Database Import

Dan's picture

When you need a zip code database for the US you should get it from here
http://www.free-zipcodes.com/
But you shouldn't spend time trying to install all the required perl (sigh) libs needed to import it into MySQL.
Simply create the table structure

CREATE TABLE zipcodes (
       zipcode INT NOT NULL PRIMARY KEY,
       latitude FLOAT(10,8),
       longitude FLOAT(10,8),
       state VARCHAR(2),
       city VARCHAR(128),
       county VARCHAR(128)
);

Then fire up Sequel Pro. File-> Import. Set "Fields terminated by" to || and uncheck "First line contains fields names."

As a bonus Sequel Pro supports ssh tunneling out of the box so you can do it directly to firewalled DBs.

As always make sure you back up your DB first incase of failure.

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockcode>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <blockcode>. Beside the tag style "<foo>" it is also possible to use "[foo]". PHP source code can also be enclosed in <?php ... ?> or <% ... %>.

More information about formatting options

CAPTCHA
Are you a robot? We usually like robots, but not in our comments.
Image CAPTCHA
Enter the characters (without spaces) shown in the image.