Initial commit
This commit is contained in:
commit
f9bfd7b7e6
|
@ -0,0 +1,2 @@
|
||||||
|
*.db
|
||||||
|
baseballdatabank-2023.1/
|
|
@ -0,0 +1,37 @@
|
||||||
|
.PHONY: db
|
||||||
|
|
||||||
|
bbdb = baseballdatabank-2023.1
|
||||||
|
|
||||||
|
db: baseball.db
|
||||||
|
|
||||||
|
baseball.db: sql/corrections/*.sql sql/keys/*.sql
|
||||||
|
rm -f baseball.db
|
||||||
|
sqlite3 baseball.db ".import --csv $(bbdb)/core/AllstarFull.csv allstarfull"
|
||||||
|
sqlite3 baseball.db ".import --csv $(bbdb)/core/Appearances.csv appearances"
|
||||||
|
sqlite3 baseball.db ".import --csv $(bbdb)/core/Batting.csv batting"
|
||||||
|
sqlite3 baseball.db ".import --csv $(bbdb)/core/BattingPost.csv battingpost"
|
||||||
|
sqlite3 baseball.db ".import --csv $(bbdb)/core/Fielding.csv fielding"
|
||||||
|
sqlite3 baseball.db ".import --csv $(bbdb)/core/FieldingOF.csv fieldingof"
|
||||||
|
sqlite3 baseball.db ".import --csv $(bbdb)/core/FieldingOFsplit.csv fieldingofsplit"
|
||||||
|
sqlite3 baseball.db ".import --csv $(bbdb)/core/FieldingPost.csv fieldingpost"
|
||||||
|
sqlite3 baseball.db ".import --csv $(bbdb)/core/HomeGames.csv homegames"
|
||||||
|
sqlite3 baseball.db ".import --csv $(bbdb)/core/Managers.csv managers"
|
||||||
|
sqlite3 baseball.db ".import --csv $(bbdb)/core/ManagersHalf.csv managershalf"
|
||||||
|
sqlite3 baseball.db ".import --csv $(bbdb)/core/Parks.csv parks"
|
||||||
|
sqlite3 baseball.db ".import --csv $(bbdb)/core/People.csv people"
|
||||||
|
sqlite3 baseball.db ".import --csv $(bbdb)/core/Pitching.csv pitching"
|
||||||
|
sqlite3 baseball.db ".import --csv $(bbdb)/core/PitchingPost.csv pitchingpost"
|
||||||
|
sqlite3 baseball.db ".import --csv $(bbdb)/core/SeriesPost.csv seriespost"
|
||||||
|
sqlite3 baseball.db ".import --csv $(bbdb)/core/Teams.csv teams"
|
||||||
|
sqlite3 baseball.db ".import --csv $(bbdb)/core/TeamsFranchises.csv teamsfranchises"
|
||||||
|
sqlite3 baseball.db ".import --csv $(bbdb)/core/TeamsHalf.csv teamshalf"
|
||||||
|
sqlite3 baseball.db ".import --csv $(bbdb)/contrib/AwardsManagers.csv awardsmanagers"
|
||||||
|
sqlite3 baseball.db ".import --csv $(bbdb)/contrib/AwardsPlayers.csv awardsplayers"
|
||||||
|
sqlite3 baseball.db ".import --csv $(bbdb)/contrib/AwardsShareManagers.csv awardssharemanagers"
|
||||||
|
sqlite3 baseball.db ".import --csv $(bbdb)/contrib/AwardsSharePlayers.csv awardsshareplayers"
|
||||||
|
sqlite3 baseball.db ".import --csv $(bbdb)/contrib/CollegePlaying.csv collegeplaying"
|
||||||
|
sqlite3 baseball.db ".import --csv $(bbdb)/contrib/HallOfFame.csv halloffame"
|
||||||
|
sqlite3 baseball.db ".import --csv $(bbdb)/contrib/Salaries.csv salaries"
|
||||||
|
sqlite3 baseball.db ".import --csv $(bbdb)/contrib/Schools.csv schools"
|
||||||
|
cat sql/corrections/*.sql | sqlite3 baseball.db
|
||||||
|
cat sql/keys/*.sql | sqlite3 baseball.db
|
|
@ -0,0 +1,12 @@
|
||||||
|
begin;
|
||||||
|
update allstarfull
|
||||||
|
set gamenum = 1
|
||||||
|
where gameid = 'ALS196207100';
|
||||||
|
|
||||||
|
update allstarfull
|
||||||
|
set gamenum = 2
|
||||||
|
where gameid = 'NLS196207300';
|
||||||
|
|
||||||
|
delete from allstarfull
|
||||||
|
where playerid = 'freesda01' and yearid = 2012 and lgid = 'AL';
|
||||||
|
commit;
|
|
@ -0,0 +1,17 @@
|
||||||
|
BEGIN;
|
||||||
|
CREATE TABLE "pk_allstarfull" (
|
||||||
|
"playerID" NUMERIC,
|
||||||
|
"yearID" NUMERIC,
|
||||||
|
"gameNum" NUMERIC,
|
||||||
|
"gameID" NUMERIC,
|
||||||
|
"teamID" NUMERIC,
|
||||||
|
"lgID" NUMERIC,
|
||||||
|
"GP" NUMERIC,
|
||||||
|
"startingPos" NUMERIC,
|
||||||
|
primary key("playerID","yearID","gameNum","startingPos")
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO "pk_allstarfull" SELECT DISTINCT * FROM "allstarfull";
|
||||||
|
DROP TABLE "allstarfull";
|
||||||
|
ALTER TABLE "pk_allstarfull" RENAME TO "allstarfull";
|
||||||
|
COMMIT;
|
|
@ -0,0 +1,33 @@
|
||||||
|
BEGIN;
|
||||||
|
CREATE TABLE "pk_people" (
|
||||||
|
"playerID" NUMERIC,
|
||||||
|
"birthYear" NUMERIC,
|
||||||
|
"birthMonth" NUMERIC,
|
||||||
|
"birthDay" NUMERIC,
|
||||||
|
"birthCountry" NUMERIC,
|
||||||
|
"birthState" NUMERIC,
|
||||||
|
"birthCity" NUMERIC,
|
||||||
|
"deathYear" NUMERIC,
|
||||||
|
"deathMonth" NUMERIC,
|
||||||
|
"deathDay" NUMERIC,
|
||||||
|
"deathCountry" NUMERIC,
|
||||||
|
"deathState" NUMERIC,
|
||||||
|
"deathCity" NUMERIC,
|
||||||
|
"nameFirst" NUMERIC,
|
||||||
|
"nameLast" NUMERIC,
|
||||||
|
"nameGiven" NUMERIC,
|
||||||
|
"weight" NUMERIC,
|
||||||
|
"height" NUMERIC,
|
||||||
|
"bats" NUMERIC,
|
||||||
|
"throws" NUMERIC,
|
||||||
|
"debut" NUMERIC,
|
||||||
|
"finalGame" NUMERIC,
|
||||||
|
"retroID" NUMERIC,
|
||||||
|
"bbrefID" NUMERIC,
|
||||||
|
primary key("playerID")
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO "pk_people" SELECT DISTINCT * FROM "people";
|
||||||
|
DROP TABLE "people";
|
||||||
|
ALTER TABLE "pk_people" RENAME TO "people";
|
||||||
|
COMMIT;
|
Loading…
Reference in New Issue