add leagues table

This commit is contained in:
Nick Griffey 2024-01-27 21:48:57 -06:00
parent 45b6b1a79a
commit 8c475d36e5
3 changed files with 23 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/teamseasons.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 sql/teams.sql baseball-transformed.db: baseball-raw.db sql/awards.sql sql/franchises.sql sql/teamseasons.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 sql/teams.sql sql/leagues.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
@ -29,6 +29,7 @@ baseball-transformed.db: baseball-raw.db sql/awards.sql sql/franchises.sql sql/t
cat sql/seriespost.sql | sqlite3 baseball-transformed.db cat sql/seriespost.sql | sqlite3 baseball-transformed.db
cat sql/fieldingofsplit.sql | sqlite3 baseball-transformed.db cat sql/fieldingofsplit.sql | sqlite3 baseball-transformed.db
cat sql/teams.sql | sqlite3 baseball-transformed.db cat sql/teams.sql | sqlite3 baseball-transformed.db
cat sql/leagues.sql | sqlite3 baseball-transformed.db
baseball-raw.db: baseball-raw.db:
rm -f baseball-raw.db rm -f baseball-raw.db

14
sql/leagues.sql Normal file
View File

@ -0,0 +1,14 @@
begin;
create table if not exists "leagues" (
"ID" text
);
insert into leagues values
("NA"),
("NL"),
("AA"),
("UA"),
("PL"),
("AL"),
("FL");
commit;

View File

@ -357,4 +357,11 @@ create table if not exists teams (
); );
insert into teams select distinct * from "transformed"."teams"; insert into teams select distinct * from "transformed"."teams";
create table if not exists "leagues" (
"ID" text,
primary key("ID")
);
insert into leagues select distinct * from "transformed"."leagues";
COMMIT; COMMIT;