move fieldingofsplit
This commit is contained in:
parent
30010d5880
commit
c5c4cbd1cf
3
Makefile
3
Makefile
|
@ -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
|
||||||
|
|
|
@ -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;
|
|
25
sql/load.sql
25
sql/load.sql
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue