add collegeplaying

This commit is contained in:
Nick Griffey 2024-01-27 19:14:33 -06:00
parent 9c955df284
commit 7ed54099e4
3 changed files with 13 additions and 1 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 baseball-transformed.db: baseball-raw.db sql/awards.sql sql/franchises.sql sql/franchiseseasons.sql sql/seasons.sql sql/parks.sql sql/collegeplaying.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
@ -17,6 +17,7 @@ baseball-transformed.db: baseball-raw.db sql/awards.sql sql/franchises.sql sql/f
cat sql/awards.sql | sqlite3 baseball-transformed.db cat sql/awards.sql | sqlite3 baseball-transformed.db
cat sql/seasons.sql | sqlite3 baseball-transformed.db cat sql/seasons.sql | sqlite3 baseball-transformed.db
cat sql/parks.sql | sqlite3 baseball-transformed.db cat sql/parks.sql | sqlite3 baseball-transformed.db
cat sql/collegeplaying.sql | sqlite3 baseball-transformed.db
baseball-raw.db: baseball-raw.db:
rm -f baseball-raw.db rm -f baseball-raw.db

View File

@ -134,4 +134,15 @@ CREATE TABLE IF NOT EXISTS "parkaliases" (
); );
insert into "parkaliases" select distinct * from "transformed"."parkaliases"; insert into "parkaliases" select distinct * from "transformed"."parkaliases";
CREATE TABLE IF NOT EXISTS "collegeplaying" (
"playerID" TEXT,
"schoolID" TEXT,
"yearID" NUMERIC,
PRIMARY KEY("playerID","yearID","schoolID"),
foreign key("playerID") references "people"("playerID"),
foreign key("schoolID") references "schools"("schoolID")
);
insert into collegeplaying select distinct * from "transformed"."collegeplaying";
COMMIT; COMMIT;