
##Create testing db

CREATE DATABASE IF NOT EXISTS Testing;

##Drop table if exists

##CREATE The TABLE FOR CSV LOAD

CREATE TABLE Testing.BaseBallTest (id INT(5) PRIMARY KEY AUTO_INCREMENT, yearID INT(5),teamID VARCHAR(10),lgID VARCHAR(10),playerID VARCHAR(15),G_all INT(5),GS INT(5),G_batting INT(5),G_defense INT(5),G_p INT(5),G_c INT(5),G_1b INT(5),G_2b INT(5),G_3b INT(5),G_ss INT(5),G_lf INT(5),G_cf INT(5),G_rf INT(5),G_of INT(5),G_dh INT(5),G_ph INT(5),G_pr INT(5) );


##LOAD CSV
LOAD DATA LOCAL INFILE 'Appearances.csv' INTO TABLE Testing.BaseBallTest FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' IGNORE 1 ROWS (yearID,teamID,lgID,playerID,G_all,GS,G_batting,G_defense,G_p,G_c,G_1b,G_2b,G_3b,G_ss,G_lf,G_cf,G_rf,G_of,G_dh,G_ph,G_pr);

##COUNT THE ROWS ON MY SYSTEMS HERE IT RETURNS 90000
SELECT COUNT(*) FROM Testing.BaseBallTest;

##SLEEP A LITTLE WHILE 
SELECT SLEEP(5);

##NOW WE GET CORRECT COUNT 99466
select count(*) from Testing.BaseBallTest;
