Last active
December 24, 2015 08:09
-
-
Save PhillyCDO/6768612 to your computer and use it in GitHub Desktop.
Import flu shot locations into an MySQL instance.
This file contains 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
DROP DATABASE IF EXISTS flushots; | |
CREATE DATABASE flushots; | |
USE flushots; | |
DROP TABLE IF EXISTS locations; | |
CREATE TABLE locations( | |
facility_name VARCHAR(80), | |
facility_id CHAR(10), | |
facility_type VARCHAR(90), | |
street1 VARCHAR(100), | |
street2 VARCHAR(100), | |
city VARCHAR(65), | |
state VARCHAR(40), | |
postal_code CHAR(5), | |
country CHAR(2), | |
latitude FLOAT, | |
longitude FLOAT, | |
phone VARCHAR(12), | |
contact VARCHAR(80), | |
url VARCHAR(100), | |
begin_date CHAR(10), | |
end_date CHAR(10), | |
begin_time CHAR(13), | |
end_time CHAR(13), | |
eligibility VARCHAR(200), | |
documents VARCHAR(200), | |
cost FLOAT, | |
currency_code CHAR(3), | |
notes VARCHAR(200), | |
file_start_date CHAR(10), | |
file_end_date CHAR(10) | |
); | |
LOAD DATA INFILE '/tmp/locations.csv' INTO TABLE locations | |
FIELDS TERMINATED BY ',' | |
ENCLOSED BY '"' | |
LINES TERMINATED BY '\n' | |
IGNORE 1 LINES | |
(facility_name, facility_id, facility_type, street1, street2, city, state, postal_code, country, latitude, longitude, phone, contact, url, begin_date, end_date, begin_time, end_time, | |
eligibility, documents, cost, currency_code, notes, file_start_date, file_end_date); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment