1. Create table in postgresql
CREATE TABLE zipcodes (
zip char(5),
city varchar,
state char(5),
latitude double precision,
longitude double precision,
timezone varchar, dst varchar);
2. write import statement
COPY
zipcodes FROM 'C:/ZipCodes.csv' DELIMITER ',' CSV;
3. Sample data for csv
Ø "00210","Portsmouth","NH","43.005895","-71.013202","-5","1"
Ø "00211","Portsmouth","NH","43.005895","-71.013202","-5","1"
Ø "00212","Portsmouth","NH","43.005895","-71.013202","-5","1"
Ø "00213","Portsmouth","NH","43.005895","-71.013202","-5","1"
Ø "00214","Portsmouth","NH","43.005895","-71.013202","-5","1"
Ø "00215","Portsmouth","NH","43.005895","-71.013202","-5","1"
Ø "00501","Holtsville","NY","40.922326","-72.637078","-5","1"
Ø "00544","Holtsville","NY","40.922326","-72.637078","-5","1"
0 comments: