Created
August 18, 2010 13:12
-
-
Save jaymzcd/534679 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Add a blank column at the start for the id field */ | |
| sed -e 's/\(.*\)/,\1/g' zipcodes.txt > /tmp/codes.txt && mv /tmp/codes.txt zipcodes.txt | |
| /* Table structure for the zipcode data from | |
| http://www.populardata.com/zipcode_database.html */ | |
| BEGIN; | |
| CREATE TABLE `zipsearch_zipcodeentry` ( | |
| `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, | |
| `zipcode` varchar(5) NOT NULL, | |
| `latitude` numeric(9, 6) NOT NULL, | |
| `longitude` numeric(9, 6) NOT NULL, | |
| `city_name` varchar(25) NOT NULL, | |
| `state` varchar(2) NOT NULL, | |
| `county` varchar(25) NOT NULL, | |
| `format` varchar(50) NOT NULL | |
| ); | |
| COMMIT; | |
| /* Load in and done \o/ */ | |
| LOAD DATA LOCAL INFILE 'zipcodes.txt' INTO TABLE zipsearch_zipcodeentry | |
| FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment