text: DROP TABLE IF EXISTS ALL_PRECINCTS;
  CREATE TABLE ALL_PRECINCTS (
      County INT NOT NULL,
      ElectionDistrict INT NOT NULL,
      ElectionPrecinct INT NOT NULL,
      Cong INT NOT NULL,
      Legs VARCHAR(10) NOT NULL,
      CandidateName VARCHAR(40) NOT NULL,
      Party VARCHAR(10),
      OfficeName VARCHAR(40) NOT NULL,
      OfficeDistrict VARCHAR(10),
      Winner VARCHAR(10),
      WriteIn VARCHAR(10),
      ElectionNightVotes INT,
      ElectionNightVotesAgainst INT,
      PRIMARY KEY (County, ElectionDistrict, ElectionPrecinct, Cong, Legs,
          CandidateName, OfficeName)
  );
  
  -- LOAD DATA LOCAL INFILE 'data/md_election_data/All_By_Precinct_NonPartisan_2018_Primary.csv'
  -- INTO TABLE ALL_PRECINCTS
  -- FIELDS TERMINATED BY ','
  -- ENCLOSED BY '"'
  -- LINES TERMINATED BY '\n'
  -- IGNORE 1 LINES;
  
  -- LOAD DATA LOCAL INFILE 'data/md_election_data/All_By_Precinct_Democratic_2018_Primary.csv'
  -- INTO TABLE ALL_PRECINCTS
  -- FIELDS TERMINATED BY ','
  -- ENCLOSED BY '"'
  -- LINES TERMINATED BY '\n'
  -- IGNORE 1 LINES;
  
  -- LOAD DATA LOCAL INFILE 'data/md_election_data/All_By_Precinct_Republican_2018_Primary.csv'
  -- INTO TABLE ALL_PRECINCTS
  -- FIELDS TERMINATED BY ','
  -- ENCLOSED BY '"'
  -- LINES TERMINATED BY '\n'
  -- IGNORE 1 LINES;
  
  LOAD DATA LOCAL INFILE 'data/md_general/All_By_Precinct_2018_General.csv'
  INTO TABLE ALL_PRECINCTS
  FIELDS TERMINATED BY ','
  ENCLOSED BY '"'
  LINES TERMINATED BY '\n'
  IGNORE 1 LINES;
  
  DROP TABLE IF EXISTS ALL_CONGRESSIONAL;
  CREATE TABLE ALL_CONGRESSIONAL (
      VoteType INT NOT NULL,
      County INT NOT NULL,
      CandidateName VARCHAR(40) NOT NULL,
      Party VARCHAR(10),
      OfficeName VARCHAR(40) NOT NULL,
      OfficeDistrict VARCHAR(10),
      Winner VARCHAR(10),
      WriteIn VARCHAR(10),
      CongDist01 INT NOT NULL,
      CongDist02 INT NOT NULL,
      CongDist03 INT NOT NULL,
      CongDist04 INT NOT NULL,
      CongDist05 INT NOT NULL,
      CongDist06 INT NOT NULL,
      CongDist07 INT NOT NULL,
      CongDist08 INT NOT NULL,
      PRIMARY KEY (VoteType, County, CandidateName, OfficeName, CongDist01,
          CongDist02, CongDist03, CongDist04, CongDist05, CongDist06, CongDist07, CongDist08)
  );
  
  
  LOAD DATA LOCAL INFILE 'data/md_general/State_Legislative_Districts_2018_General.csv'
  INTO TABLE ALL_CONGRESSIONAL
  FIELDS TERMINATED BY ','
  ENCLOSED BY '"'
  LINES TERMINATED BY '\n'
  IGNORE 1 LINES;
  
  DROP TABLE IF EXISTS ALL_LEGISLATIVE;
  CREATE TABLE ALL_LEGISLATIVE (
      VoteType INT NOT NULL,
      County INT NOT NULL,
      CandidateName VARCHAR(40) NOT NULL,
      Party VARCHAR(10),
      OfficeName VARCHAR(40) NOT NULL,
      OfficeDistrict VARCHAR(10),
      Winner VARCHAR(10),
      WriteIn VARCHAR(10),
      LegDist01A VARCHAR(5) NOT NULL,
      LegDist01B VARCHAR(5) NOT NULL,
      LegDist01C VARCHAR(5) NOT NULL,
      LegDist02A VARCHAR(5) NOT NULL,
      LegDist02B VARCHAR(5) NOT NULL,
      LegDist03A VARCHAR(5) NOT NULL,
      LegDist03B VARCHAR(5) NOT NULL,
      LegDist04 VARCHAR(5) NOT NULL,
      LegDist05 VARCHAR(5) NOT NULL,
      LegDist06 VARCHAR(5) NOT NULL,
      LegDist07 VARCHAR(5) NOT NULL,
      LegDist08 VARCHAR(5) NOT NULL,
      LegDist09A VARCHAR(5) NOT NULL,
      LegDist09B VARCHAR(5) NOT NULL,
      LegDist10 VARCHAR(5) NOT NULL,
      LegDist11 VARCHAR(5) NOT NULL,
      LegDist12 VARCHAR(5) NOT NULL,
      LegDist13 VARCHAR(5) NOT NULL,
      LegDist14 VARCHAR(5) NOT NULL,
      LegDist15 VARCHAR(5) NOT NULL,
      LegDist16 VARCHAR(5) NOT NULL,
      LegDist17 VARCHAR(5) NOT NULL,
      LegDist18 VARCHAR(5) NOT NULL,
      LegDist19 VARCHAR(5) NOT NULL,
      LegDist20 VARCHAR(5) NOT NULL,
      LegDist21 VARCHAR(5) NOT NULL,
      LegDist22 VARCHAR(5) NOT NULL,
      LegDist23A VARCHAR(5) NOT NULL,
      LegDist23B VARCHAR(5) NOT NULL,
      LegDist24 VARCHAR(5) NOT NULL,
      LegDist25 VARCHAR(5) NOT NULL,
      LegDist26 VARCHAR(5) NOT NULL,
      LegDist27A VARCHAR(5) NOT NULL,
      LegDist27B VARCHAR(5) NOT NULL,
      LegDist27C VARCHAR(5) NOT NULL,
      LegDist28 VARCHAR(5) NOT NULL,
      LegDist29A VARCHAR(5) NOT NULL,
      LegDist29B VARCHAR(5) NOT NULL,
      LegDist29C VARCHAR(5) NOT NULL,
      LegDist30A VARCHAR(5) NOT NULL,
      LegDist30B VARCHAR(5) NOT NULL,
      LegDist31A VARCHAR(5) NOT NULL,
      LegDist31B VARCHAR(5) NOT NULL,
      LegDist32 VARCHAR(5) NOT NULL,
      LegDist33 VARCHAR(5) NOT NULL,
      LegDist34A VARCHAR(5) NOT NULL,
      LegDist34B VARCHAR(5) NOT NULL,
      LegDist35A VARCHAR(5) NOT NULL,
      LegDist35B VARCHAR(5) NOT NULL,
      LegDist36 VARCHAR(5) NOT NULL,
      LegDist37A VARCHAR(5) NOT NULL,
      LegDist37B VARCHAR(5) NOT NULL,
      LegDist38A VARCHAR(5) NOT NULL,
      LegDist38B VARCHAR(5) NOT NULL,
      LegDist38C VARCHAR(5) NOT NULL,
      LegDist39 VARCHAR(5) NOT NULL,
      LegDist40 VARCHAR(5) NOT NULL,
      LegDist41 VARCHAR(5) NOT NULL,
      LegDist42A VARCHAR(5) NOT NULL,
      LegDist42B VARCHAR(5) NOT NULL,
      LegDist43 VARCHAR(5) NOT NULL,
      LegDist44A VARCHAR(5) NOT NULL,
      LegDist44B VARCHAR(5) NOT NULL,
      LegDist45 VARCHAR(5) NOT NULL,
      LegDist46 VARCHAR(5) NOT NULL,
      LegDist47A VARCHAR(5) NOT NULL,
      LegDist47B VARCHAR(5) NOT NULL
      -- PRIMARY KEY (VoteType, County, CandidateName, OfficeName, LegDist01A, LegDist01B,
      --     LegDist01C,LegDist02A,LegDist02B,LegDist03A,LegDist03B,LegDist04,LegDist05,
      --     LegDist06,LegDist07,LegDist08,LegDist09A,LegDist09B,LegDist10,LegDist11,LegDist12,
      --     LegDist13,LegDist14,LegDist15,LegDist16,LegDist17,LegDist18,LegDist19,LegDist20,
      --     LegDist21,LegDist22,LegDist23A,LegDist23B,LegDist24,LegDist25,LegDist26,LegDist27A,
      --     LegDist27B,LegDist27C,LegDist28,LegDist29A,LegDist29B,LegDist29C,LegDist30A,LegDist30B,
      --     LegDist31A,LegDist31B,LegDist32,LegDist33,LegDist34A,LegDist34B,LegDist35A,LegDist35B,
      --     LegDist36,LegDist37A,LegDist37B,LegDist38A,LegDist38B,LegDist38C,LegDist39,LegDist40,
      --     LegDist41,LegDist42A,LegDist42B,LegDist43,LegDist44A,LegDist44B,LegDist45,LegDist46,
      --     LegDist47A,LegDist47B)
  );
  
  LOAD DATA LOCAL INFILE 'data/md_general/State_Legislative_Districts_2018_General.csv'
  INTO TABLE ALL_LEGISLATIVE
  FIELDS TERMINATED BY ','
  ENCLOSED BY '"'
  LINES TERMINATED BY '\n'
  IGNORE 1 LINES;
  
  DROP TABLE IF EXISTS CONGRESSIONAL_CONVERSION;
  CREATE TABLE CONGRESSIONAL_CONVERSION (
      CID INT NOT NULL,
      CongCol VARCHAR(20),
      PRIMARY KEY (CID)
  );
  
  INSERT INTO CONGRESSIONAL_CONVERSION VALUES (1, 'CongDist01');
  INSERT INTO CONGRESSIONAL_CONVERSION VALUES (2, 'CongDist02');
  INSERT INTO CONGRESSIONAL_CONVERSION VALUES (3, 'CongDist03');
  INSERT INTO CONGRESSIONAL_CONVERSION VALUES (4, 'CongDist04');
  INSERT INTO CONGRESSIONAL_CONVERSION VALUES (5, 'CongDist05');
  INSERT INTO CONGRESSIONAL_CONVERSION VALUES (6, 'CongDist06');
  INSERT INTO CONGRESSIONAL_CONVERSION VALUES (7, 'CongDist07');
  INSERT INTO CONGRESSIONAL_CONVERSION VALUES (8, 'CongDist08');
  
  DROP TABLE IF EXISTS LEGISLATIVE_CONVERSION;
  CREATE TABLE LEGISLATIVE_CONVERSION (
      LID VARCHAR(5) NOT NULL,
      LegCol VARCHAR(20),
      PRIMARY KEY (LID)
  );
  
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('1A', 'LegDist01A');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('1B', 'LegDist01B');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('1C', 'LegDist01C');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('2A', 'LegDist02A');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('2B', 'LegDist02B');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('3A', 'LegDist03A');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('3B', 'LegDist03B');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('4', 'LegDist04');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('5', 'LegDist05');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('6', 'LegDist06');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('7', 'LegDist07');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('8', 'LegDist08');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('9A', 'LegDist09A');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('9B', 'LegDist09B');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('10', 'LegDist10');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('11', 'LegDist11');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('12', 'LegDist12');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('13', 'LegDist13');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('14', 'LegDist14');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('15', 'LegDist15');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('16', 'LegDist16');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('17', 'LegDist17');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('18', 'LegDist18');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('19', 'LegDist19');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('20', 'LegDist20');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('21', 'LegDist21');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('22', 'LegDist22');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('23A', 'LegDist23A');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('23B', 'LegDist01A');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('24', 'LegDist24');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('25', 'LegDist25');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('26', 'LegDist26');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('27A', 'LegDist27A');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('27B', 'LegDist27B');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('27C', 'LegDist27C');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('28', 'LegDist28');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('29A', 'LegDist29A');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('29B', 'LegDist29B');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('29C', 'LegDist29C');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('30A', 'LegDist30A');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('30B', 'LegDist30B');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('31A', 'LegDist31A');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('31B', 'LegDist31B');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('32', 'LegDist32');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('33', 'LegDist33');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('34A', 'LegDist34A');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('34B', 'LegDist34B');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('35A', 'LegDist35A');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('35B', 'LegDist35B');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('36', 'LegDist36');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('37A', 'LegDist37A');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('37B', 'LegDist37B');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('38A', 'LegDist38A');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('38B', 'LegDist38B');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('38C', 'LegDist38C');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('39', 'LegDist39');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('40', 'LegDist40');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('41', 'LegDist41');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('42A', 'LegDist42A');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('42B', 'LegDist42B');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('43', 'LegDist43');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('44A', 'LegDist44A');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('44B', 'LegDist44B');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('45', 'LegDist45');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('46', 'LegDist46');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('47A', 'LegDist47A');
  INSERT INTO LEGISLATIVE_CONVERSION VALUES ('47B', 'LegDist47B');
  
  DROP TABLE IF EXISTS COUNTY_CONVERSION;
  CREATE TABLE COUNTY_CONVERSION (
      CID INT NOT NULL,
      CountyCol VARCHAR(20),
      PRIMARY KEY (CID)
  );
  
  INSERT INTO COUNTY_CONVERSION VALUES (1, 'ALLEGANY');
  INSERT INTO COUNTY_CONVERSION VALUES (2, 'ANNE ARUNDEL');
  INSERT INTO COUNTY_CONVERSION VALUES (3, 'BALTIMORE CITY');
  INSERT INTO COUNTY_CONVERSION VALUES (4, 'BALTIMORE COUNTY');
  INSERT INTO COUNTY_CONVERSION VALUES (5, 'CALVERT');
  INSERT INTO COUNTY_CONVERSION VALUES (6, 'CAROLINE');
  INSERT INTO COUNTY_CONVERSION VALUES (7, 'CARROLL');
  INSERT INTO COUNTY_CONVERSION VALUES (8, 'CECIL');
  INSERT INTO COUNTY_CONVERSION VALUES (9, 'CHARLES');
  INSERT INTO COUNTY_CONVERSION VALUES (10, 'DORCHESTER');
  INSERT INTO COUNTY_CONVERSION VALUES (11, 'FREDERICK');
  INSERT INTO COUNTY_CONVERSION VALUES (12, 'GARRETT');
  INSERT INTO COUNTY_CONVERSION VALUES (13, 'HARFORD');
  INSERT INTO COUNTY_CONVERSION VALUES (14, 'HOWARD');
  INSERT INTO COUNTY_CONVERSION VALUES (15, 'KENT');
  INSERT INTO COUNTY_CONVERSION VALUES (16, 'MONTGOMERY');
  INSERT INTO COUNTY_CONVERSION VALUES (17, 'PRINCE GEORGE\'S');
  INSERT INTO COUNTY_CONVERSION VALUES (18, 'QUEEN ANNE\'S');
  INSERT INTO COUNTY_CONVERSION VALUES (19, 'SOMERSET');
  INSERT INTO COUNTY_CONVERSION VALUES (20, 'ST. MARY\'S');
  INSERT INTO COUNTY_CONVERSION VALUES (21, 'TALBOT');
  INSERT INTO COUNTY_CONVERSION VALUES (22, 'WASHINGTON');
  INSERT INTO COUNTY_CONVERSION VALUES (23, 'WICOMICO');
  INSERT INTO COUNTY_CONVERSION VALUES (24, 'WORCESTER');
  
  
  DROP TABLE IF EXISTS BALTIMORE_CITY;
  CREATE TABLE BALTIMORE_CITY (
      County VARCHAR(10) NOT NULL,
      ElectionDistrict VARCHAR(10) NOT NULL,
      ElectionPrecinct VARCHAR(10) NOT NULL,
      Cong VARCHAR(10) NOT NULL,
      Legs VARCHAR(10) NOT NULL,
      CandidateName VARCHAR(40) NOT NULL,
      Party VARCHAR(10),
      OfficeName VARCHAR(40) NOT NULL,
      OfficeDistrict VARCHAR(10),
      Winner VARCHAR(10),
      ElectionNightVotes INT,
      PRIMARY KEY (County, ElectionDistrict, ElectionPrecinct, Cong, Legs,
          CandidateName, OfficeName)
  );
  
  LOAD DATA LOCAL INFILE 'data/md_election_data/Baltimore_By_Precinct_NonPartisan_2018_Primary.csv'
  INTO TABLE BALTIMORE_CITY
  FIELDS TERMINATED BY ','
  ENCLOSED BY '"'
  LINES TERMINATED BY '\n'
  IGNORE 1 LINES;
  
  LOAD DATA LOCAL INFILE 'data/md_election_data/Baltimore_By_Precinct_Democratic_2018_Primary.csv'
  INTO TABLE BALTIMORE_CITY
  FIELDS TERMINATED BY ','
  ENCLOSED BY '"'
  LINES TERMINATED BY '\n'
  IGNORE 1 LINES;
  
  LOAD DATA LOCAL INFILE 'data/md_election_data/Baltimore_By_Precinct_Republican_2018_Primary.csv'
  INTO TABLE BALTIMORE_CITY
  FIELDS TERMINATED BY ','
  ENCLOSED BY '"'
  LINES TERMINATED BY '\n'
  IGNORE 1 LINES;
  
  LOAD DATA LOCAL INFILE 'data/md_election_data/Baltimore_City_By_Precinct_Democratic_2018_Primary.csv'
  INTO TABLE BALTIMORE_CITY
  FIELDS TERMINATED BY ','
  ENCLOSED BY '"'
  LINES TERMINATED BY '\n'
  IGNORE 1 LINES;
  
  LOAD DATA LOCAL INFILE 'data/md_election_data/Baltimore_City_By_Precinct_Republican_2018_Primary.csv'
  INTO TABLE BALTIMORE_CITY
  FIELDS TERMINATED BY ','
  ENCLOSED BY '"'
  LINES TERMINATED BY '\n'
  IGNORE 1 LINES;
  
  DROP TABLE IF EXISTS ELIGIBLE_ACTIVE_VOTERS;
  CREATE TABLE ELIGIBLE_ACTIVE_VOTERS (
      District VARCHAR(10) NOT NULL,
      County VARCHAR(40) NOT NULL,
      DEM INT,
      REP INT,
      LIB INT,
      GRN INT,
      UNA INT,
      OTH INT,
      PRIMARY KEY (District, County)
  );
  
  LOAD DATA LOCAL INFILE 'data/eligible_voters.csv'
  INTO TABLE ELIGIBLE_ACTIVE_VOTERS
  FIELDS TERMINATED BY ','
  ENCLOSED BY '"'
  LINES TERMINATED BY '\n'
  IGNORE 1 LINES;
  
  
  DROP TABLE IF EXISTS DRUG_ALCOHOL_DEATHS;
  CREATE TABLE DRUG_ALCOHOL_DEATHS (
      County VARCHAR(40) NOT NULL,
      `2007` INT,
      `2008` INT,
      `2009` INT,
      `2010` INT,
      `2011` INT,
      `2012` INT,
      `2013` INT,
      `2015` INT,
      `2016` INT,
      Total INT,
      PRIMARY KEY (County)
  );
  
  LOAD DATA LOCAL INFILE 'data/Number_of_Drug_and_Alcohol-Related_Intoxication_Deaths_by_Place_of_Occurrence__2007-2016_1__2_.csv'
  INTO TABLE DRUG_ALCOHOL_DEATHS
  FIELDS TERMINATED BY ','
  ENCLOSED BY '"'
  LINES TERMINATED BY '\n'
  IGNORE 1 LINES;
  
  
  DROP TABLE IF EXISTS VEHICLE_REGISTRATION;
  CREATE TABLE VEHICLE_REGISTRATION (
      County VARCHAR(40) NOT NULL,
      `2010` INT,
      `2011` INT,
      `2012` INT,
      `2013` INT,
      `2015` INT,
      `2016` INT,
      `2017` INT,
      PRIMARY KEY (County)
  );
  
  LOAD DATA LOCAL INFILE 'data/vehicle_registration.csv'
  INTO TABLE VEHICLE_REGISTRATION
  FIELDS TERMINATED BY ','
  ENCLOSED BY '"'
  LINES TERMINATED BY '\n'
  IGNORE 1 LINES;
  
  DROP TABLE IF EXISTS 911_CALLS;
  CREATE TABLE 911_CALLS (
      id INT NOT NULL,
      callDateTime DATETIME,
      priority VARCHAR(25),
      district VARCHAR(10),
      description VARCHAR(40),
      callNumber VARCHAR(25),
      incidentLocation VARCHAR(40),
      location VARCHAR(40),
      PRIMARY KEY (id)
  );
  
  LOAD DATA LOCAL INFILE 'data/911_calls_for_service.csv'
  INTO TABLE 911_CALLS
  FIELDS TERMINATED BY ','
  ENCLOSED BY '"'
  LINES TERMINATED BY '\n'
  IGNORE 1 LINES;
  
  DROP TABLE IF EXISTS 911_CALLS_CONVERSION;
  CREATE TABLE 911_CALLS_CONVERSION (
      Location VARCHAR(40) NOT NULL,
      CongressionalDistrict INT,
      County VARCHAR(25),
      LegislativeDistrict VARCHAR(5),
      Neighborhood VARCHAR(40),
      Zipcode INT,
      PRIMARY KEY (Location, CongressionalDistrict, County, LegislativeDistrict,
          Neighborhood, Zipcode)
  );
  
  LOAD DATA LOCAL INFILE 'data/location_geocoded.csv'
  INTO TABLE 911_CALLS_CONVERSION
  FIELDS TERMINATED BY ','
  ENCLOSED BY '"'
  LINES TERMINATED BY '\n'
  IGNORE 1 LINES;
  
  DROP TABLE IF EXISTS CRIME_IN_BALTIMORE;
  CREATE TABLE CRIME_IN_BALTIMORE (
      CrimeDate DATE NOT NULL,
      CrimeTime TIME NOT NULL,
      CrimeCode VARCHAR(10),
      Location VARCHAR(40),
      Description VARCHAR(40),
      InsideOutside VARCHAR(10),
      Weapon VARCHAR(10),
      Post INT,
      District VARCHAR(25),
      Neighborhood VARCHAR(25),
      Longitude REAL,
      Latitude REAL,
      Coordinate VARCHAR(40),
      Premise VARCHAR(25),
      TotalIncidents INT,
      PRIMARY KEY (CrimeDate, CrimeTime, Location)
  );
  
  LOAD DATA LOCAL INFILE 'data/BPD_Part_1_Victim_Based_Crime_Data.csv'
  INTO TABLE CRIME_IN_BALTIMORE
  FIELDS TERMINATED BY ','
  ENCLOSED BY '"'
  LINES TERMINATED BY '\n'
  IGNORE 1 LINES
  (@tmp_date, CrimeTime, CrimeCode, Location, Description, InsideOutside, Weapon,
      Post, District, Neighborhood, Latitude, Longitude, Coordinate, Premise, TotalIncidents)
  SET CrimeDate = STR_TO_DATE(@tmp_date, '%m/%d/%Y');
  
  DROP TABLE IF EXISTS VACANT_BUILDINGS;
  CREATE TABLE VACANT_BUILDINGS (
      ReferenceID INT NOT NULL,
      Block INT,
      Lot INT,
      BuildingAddress VARCHAR(25),
      NoticeDate DATE,
      Neighborhood VARCHAR(40),
      CouncilDistrict INT,
      location VARCHAR(40),
      PRIMARY KEY (ReferenceID)
  );
  
  LOAD DATA LOCAL INFILE 'data/Vacant_Buildings.csv'
  INTO TABLE VACANT_BUILDINGS
  FIELDS TERMINATED BY ','
  ENCLOSED BY '"'
  LINES TERMINATED BY '\n'
  IGNORE 1 LINES
  (ReferenceID, Block, Lot, BuildingAddress, @tmp_date, Neighborhood, CouncilDistrict, location)
  SET NoticeDate = STR_TO_DATE(@tmp_date, '%m/%d/%Y');
  
  
  DROP TABLE IF EXISTS POLLING_LOCATIONS;
  CREATE TABLE POLLING_LOCATIONS (
      name VARCHAR(70) NOT NULL,
      secondary VARCHAR(70),
      precinct INT,
      zipcode INT,
      legislative INT,
      congressional INT,
      judicical INT,
      appellate INT,
      councilman INT,
      isPublic INT,
      snowRoute VARCHAR(10),
      location VARCHAR(25),
      PRIMARY KEY (name)
  );
  
  LOAD DATA LOCAL INFILE 'data/Polling_Locations.csv'
  INTO TABLE POLLING_LOCATIONS
  FIELDS TERMINATED BY ','
  ENCLOSED BY '"'
  LINES TERMINATED BY '\n'
  IGNORE 1 LINES;
  
  DROP TABLE IF EXISTS GROCERY_STORES;
  CREATE TABLE GROCERY_STORES (
      name VARCHAR(40) NOT NULL,
      type VARCHAR(25),
      zipcode INT,
      neighborhood VARCHAR(40),
      councilDistrict INT,
      policeDistrict VARCHAR(25),
      block INT,
      PRIMARY KEY (name, zipcode, neighborhood)
  );
  
  LOAD DATA LOCAL INFILE 'data/Grocery_Stores.csv'
  INTO TABLE GROCERY_STORES
  FIELDS TERMINATED BY ','
  ENCLOSED BY '"'
  LINES TERMINATED BY '\n'
  IGNORE 1 LINES;
  
  DROP TABLE IF EXISTS LIQUOR_LICENSES;
  CREATE TABLE LIQUOR_LICENSES (
      LicenseClass VARCHAR(10) NOT NULL,
      SubClass VARCHAR(10) NOT NULL,
      LicenseNumber INT,
      LicenseDate DATE NOT NULL,
      LicenseEndDate Date NOT NULL,
      LicenseYear INT NOT NULL,
      LicenseFee DECIMAL(10,2),
      CertificateNumber INT,
      LicenseStatus VARCHAR(25),
      LicenseeFirstName VARCHAR(40),
      LicenseeLastName VARCHAR(40),
      TradeName VARCHAR(40),
      CorpName VARCHAR(75),
      EstablishmentDesc VARCHAR(40),
      DaysPerWeek VARCHAR(10),
      Description VARCHAR(25),
      Address VARCHAR(40),
      Zipcode INT,
      Location1 VARCHAR(10),
      PRIMARY KEY (LicenseClass, LicenseDate, LicenseEndDate, LicenseYear,
          LicenseeFirstName, LicenseeLastName, CorpName, LicenseStatus, LicenseFee)
  );
  
  LOAD DATA LOCAL INFILE 'data/Liquor_Licenses.csv'
  INTO TABLE LIQUOR_LICENSES
  FIELDS TERMINATED BY ','
  ENCLOSED BY '"'
  LINES TERMINATED BY '\n'
  IGNORE 1 LINES
  (LicenseClass, SubClass, LicenseNumber, @tmp_start, @tmp_end, LicenseYear, LicenseFee,
      CertificateNumber, LicenseStatus, LicenseeFirstName, LicenseeLastName, TradeName,
      CorpName, EstablishmentDesc, DaysPerWeek, Description, Address, Zipcode, Location1)
  SET LicenseDate = STR_TO_DATE(@tmp_start, '%m/%d/%Y'),
      LicenseEndDate = STR_TO_DATE(@tmp_end, '%m/%d/%Y');
  
  DROP TABLE IF EXISTS MDCENSUS;
  CREATE TABLE MDCENSUS (
      County VARCHAR(20) NOT NULL,
      Population INT,
      DecadePopChange NUMERIC(3,3),
      Under5 DECIMAL(3,3),
      Under18 DECIMAL(3,3),
      Over65 DECIMAL(3,3),
      Female DECIMAL(3,3),
      White DECIMAL(3,3),
      Black DECIMAL(3,3),
      Asian DECIMAL(3,3),
      Hispanic DECIMAL(3,3),
      Veterans INT,
      ForeignBorn DECIMAL(3,3),
      HousingUnits INT,
      MedianHouseValue INT,
      MedianRent INT,
      OtherLanguage DECIMAL(3,3),
      HSGrad DECIMAL(3,3),
      BachDeg DECIMAL(3,3),
      Disability DECIMAL(3,3),
      TravelToWork DECIMAL(3,1),
      Income INT,
      Poverty DECIMAL(3,3),
      Employment INT,
      Density DECIMAL(5,1),
      PRIMARY KEY (County)
  );
  
  LOAD DATA LOCAL INFILE 'data/censusdata.csv'
  INTO TABLE MDCENSUS
  FIELDS TERMINATED BY ','
  ENCLOSED BY '"'
  LINES TERMINATED BY '\n'
  IGNORE 1 LINES;
  
  
  DROP TABLE IF EXISTS BALTIMORE_GEOGRAPHY;
  CREATE TABLE BALTIMORE_GEOGRAPHY (
      attribute VARCHAR(25) NOT NULL,
      category VARCHAR(40) NOT NULL,
      geometry POLYGON,
      PRIMARY KEY (attribute, category)
  );
  
  LOAD DATA LOCAL INFILE 'data/baltimore_geography.csv'
  INTO TABLE BALTIMORE_GEOGRAPHY
  FIELDS TERMINATED BY ','
  ENCLOSED BY '"'
  LINES TERMINATED BY '\n'
  IGNORE 1 LINES
  (attribute, category, @tmp_geom)
  SET geometry = GeomFromText(@tmp_geom);
  
  DROP TABLE IF EXISTS MARYLAND_GEOGRAPHY;
  CREATE TABLE MARYLAND_GEOGRAPHY (
      attribute VARCHAR(25) NOT NULL,
      category VARCHAR(40) NOT NULL,
      geometry POLYGON,
      PRIMARY KEY (attribute, category)
  );
  
  LOAD DATA LOCAL INFILE 'data/maryland_geography.csv'
  INTO TABLE MARYLAND_GEOGRAPHY
  FIELDS TERMINATED BY ','
  ENCLOSED BY '"'
  LINES TERMINATED BY '\n'
  IGNORE 1 LINES
  (attribute, category, @tmp_geom)
  SET geometry = GeomFromText(@tmp_geom);
  