move fieldingofsplit

This commit is contained in:
Nick Griffey 2024-01-27 20:25:09 -06:00
parent 30010d5880
commit c5c4cbd1cf
4 changed files with 27 additions and 29 deletions

View File

@ -9,7 +9,7 @@ baseball.db: baseball-transformed.db sql/load.sql
cat sql/load.sql | sqlite3 baseball.db cat sql/load.sql | sqlite3 baseball.db
sqlite3 baseball.db "VACUUM" sqlite3 baseball.db "VACUUM"
baseball-transformed.db: baseball-raw.db sql/awards.sql sql/franchises.sql sql/franchiseseasons.sql sql/seasons.sql sql/parks.sql sql/collegeplaying.sql sql/schools.sql sql/people.sql sql/salaries.sql sql/batting.sql sql/pitching.sql sql/fielding.sql sql/appearances.sql sql/homegames.sql sql/seriespost.sql baseball-transformed.db: baseball-raw.db sql/awards.sql sql/franchises.sql sql/franchiseseasons.sql sql/seasons.sql sql/parks.sql sql/collegeplaying.sql sql/schools.sql sql/people.sql sql/salaries.sql sql/batting.sql sql/pitching.sql sql/fielding.sql sql/appearances.sql sql/homegames.sql sql/seriespost.sql sql/fieldingofsplit.sql
rm -f baseball-transformed.db rm -f baseball-transformed.db
cp baseball-raw.db baseball-transformed.db cp baseball-raw.db baseball-transformed.db
cat sql/franchises.sql | sqlite3 baseball-transformed.db cat sql/franchises.sql | sqlite3 baseball-transformed.db
@ -27,6 +27,7 @@ baseball-transformed.db: baseball-raw.db sql/awards.sql sql/franchises.sql sql/f
cat sql/homegames.sql | sqlite3 baseball-transformed.db cat sql/homegames.sql | sqlite3 baseball-transformed.db
cat sql/people.sql | sqlite3 baseball-transformed.db cat sql/people.sql | sqlite3 baseball-transformed.db
cat sql/seriespost.sql | sqlite3 baseball-transformed.db cat sql/seriespost.sql | sqlite3 baseball-transformed.db
cat sql/fieldingofsplit.sql | sqlite3 baseball-transformed.db
baseball-raw.db: baseball-raw.db:
rm -f baseball-raw.db rm -f baseball-raw.db

View File

@ -1,28 +0,0 @@
BEGIN;
CREATE TABLE IF NOT EXISTS "pk_fieldingofsplit" (
"playerID" TEXT,
"yearID" NUMERIC,
"stint" NUMERIC,
"teamID" TEXT,
"lgID" TEXT,
"POS" TEXT,
"G" NUMERIC,
"GS" NUMERIC,
"InnOuts" NUMERIC,
"PO" NUMERIC,
"A" NUMERIC,
"E" NUMERIC,
"DP" NUMERIC,
"PB" NUMERIC,
"WP" NUMERIC,
"SB" NUMERIC,
"CS" NUMERIC,
"ZR" NUMERIC,
PRIMARY KEY("playerID","yearID","stint","teamID","POS"),
foreign key("playerID") references "people"("playerID")
);
INSERT INTO "pk_fieldingofsplit" SELECT DISTINCT * FROM "fieldingofsplit";
DROP TABLE "fieldingofsplit";
ALTER TABLE "pk_fieldingofsplit" RENAME TO "fieldingofsplit";
COMMIT;

View File

@ -317,4 +317,29 @@ CREATE TABLE IF NOT EXISTS "seriespost" (
); );
insert into seriespost select distinct * from "transformed"."seriespost"; insert into seriespost select distinct * from "transformed"."seriespost";
CREATE TABLE IF NOT EXISTS "fieldingofsplit" (
"player" TEXT,
"year" NUMERIC,
"stint" NUMERIC,
"team" TEXT,
"POS" TEXT,
"G" NUMERIC,
"GS" NUMERIC,
"InnOuts" NUMERIC,
"PO" NUMERIC,
"A" NUMERIC,
"E" NUMERIC,
"DP" NUMERIC,
"PB" NUMERIC,
"WP" NUMERIC,
"SB" NUMERIC,
"CS" NUMERIC,
"ZR" NUMERIC,
PRIMARY KEY("player","year","stint","team","POS"),
foreign key("player") references "people"("ID"),
foreign key("year") references "seasons"("year")
);
insert into fieldingofsplit select distinct * from "transformed"."fieldingofsplit";
COMMIT; COMMIT;