move homegames

This commit is contained in:
Nick Griffey 2024-01-27 20:13:16 -06:00
parent e1f572c122
commit 3f619aaf62
3 changed files with 21 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 sql/collegeplaying.sql sql/schools.sql sql/people.sql sql/salaries.sql sql/batting.sql sql/pitching.sql sql/fielding.sql sql/appearances.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
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
@ -24,6 +24,8 @@ baseball-transformed.db: baseball-raw.db sql/awards.sql sql/franchises.sql sql/f
cat sql/pitching.sql | sqlite3 baseball-transformed.db cat sql/pitching.sql | sqlite3 baseball-transformed.db
cat sql/fielding.sql | sqlite3 baseball-transformed.db cat sql/fielding.sql | sqlite3 baseball-transformed.db
cat sql/appearances.sql | sqlite3 baseball-transformed.db cat sql/appearances.sql | sqlite3 baseball-transformed.db
cat sql/homegames.sql | sqlite3 baseball-transformed.db
cat sql/people.sql | sqlite3 baseball-transformed.db
baseball-raw.db: baseball-raw.db:
rm -f baseball-raw.db rm -f baseball-raw.db

View File

@ -285,4 +285,22 @@ CREATE TABLE IF NOT EXISTS "appearances" (
foreign key("player") references "people"("ID"), foreign key("player") references "people"("ID"),
foreign key("year") references "seasons"("year") foreign key("year") references "seasons"("year")
); );
insert into appearances select distinct * from "transformed"."appearances";
CREATE TABLE IF NOT EXISTS "homegames" (
"year" NUMERIC,
"team" TEXT,
"park" TEXT,
"first" TEXT,
"last" TEXT,
"games" NUMERIC,
"openings" NUMERIC,
"attendance" NUMERIC,
PRIMARY KEY("year","team","park"),
foreign key("park") references "parks"("ID"),
foreign key("year") references "seasons"("year")
);
insert into homegames select distinct * from "transformed"."homegames";
COMMIT; COMMIT;