move managershalf
This commit is contained in:
parent
4e6f000d3f
commit
e80bf97a43
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/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 sql/managers.sql sql/awardsmanagers.sql sql/battingpost.sql sql/fieldingpost.sql sql/pitchingpost.sql sql/appearancespost.sql sql/awardsshareplayers.sql sql/yearlyawards.sql sql/halloffame.sql sql/halloffamereqs.sql sql/awardsplayers.sql sql/parkaliases.sql sql/teamseasonshalf.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 sql/managers.sql sql/awardsmanagers.sql sql/battingpost.sql sql/fieldingpost.sql sql/pitchingpost.sql sql/appearancespost.sql sql/awardsshareplayers.sql sql/yearlyawards.sql sql/halloffame.sql sql/halloffamereqs.sql sql/awardsplayers.sql sql/parkaliases.sql sql/teamseasonshalf.sql sql/managershalf.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
|
||||||
|
@ -43,6 +43,7 @@ baseball-transformed.db: baseball-raw.db sql/awards.sql sql/franchises.sql sql/t
|
||||||
cat sql/awardsplayers.sql | sqlite3 baseball-transformed.db
|
cat sql/awardsplayers.sql | sqlite3 baseball-transformed.db
|
||||||
cat sql/parkaliases.sql | sqlite3 baseball-transformed.db
|
cat sql/parkaliases.sql | sqlite3 baseball-transformed.db
|
||||||
cat sql/teamseasonshalf.sql | sqlite3 baseball-transformed.db
|
cat sql/teamseasonshalf.sql | sqlite3 baseball-transformed.db
|
||||||
|
cat sql/managershalf.sql | sqlite3 baseball-transformed.db
|
||||||
|
|
||||||
baseball-raw.db:
|
baseball-raw.db:
|
||||||
rm -f baseball-raw.db
|
rm -f baseball-raw.db
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
BEGIN;
|
|
||||||
CREATE TABLE IF NOT EXISTS "pk_managershalf" (
|
|
||||||
"playerID" TEXT,
|
|
||||||
"yearID" NUMERIC,
|
|
||||||
"teamID" TEXT,
|
|
||||||
"lgID" TEXT,
|
|
||||||
"inseason" NUMERIC,
|
|
||||||
"half" NUMERIC,
|
|
||||||
"G" NUMERIC,
|
|
||||||
"W" NUMERIC,
|
|
||||||
"L" NUMERIC,
|
|
||||||
"rank" NUMERIC,
|
|
||||||
PRIMARY KEY("playerID","yearID","teamID","inseason","half"),
|
|
||||||
foreign key("playerID") references "people"("playerID")
|
|
||||||
);
|
|
||||||
|
|
||||||
INSERT INTO "pk_managershalf" SELECT DISTINCT * FROM "managershalf";
|
|
||||||
DROP TABLE "managershalf";
|
|
||||||
ALTER TABLE "pk_managershalf" RENAME TO "managershalf";
|
|
||||||
COMMIT;
|
|
16
sql/load.sql
16
sql/load.sql
|
@ -593,4 +593,20 @@ CREATE TABLE IF NOT EXISTS "teamseasonshalf" (
|
||||||
);
|
);
|
||||||
|
|
||||||
insert into teamseasonshalf select distinct * from "transformed".teamseasonshalf;
|
insert into teamseasonshalf select distinct * from "transformed".teamseasonshalf;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS "managershalf" (
|
||||||
|
"ID" TEXT,
|
||||||
|
"year" NUMERIC,
|
||||||
|
"team" TEXT,
|
||||||
|
"inseason" NUMERIC,
|
||||||
|
"half" NUMERIC,
|
||||||
|
"G" NUMERIC,
|
||||||
|
"W" NUMERIC,
|
||||||
|
"L" NUMERIC,
|
||||||
|
PRIMARY KEY("ID","year","team","inseason","half"),
|
||||||
|
foreign key("ID") references "people"("ID"),
|
||||||
|
foreign key("year","team") references "teamseasons"("year","team")
|
||||||
|
);
|
||||||
|
|
||||||
|
insert into managershalf select distinct * from "transformed".managershalf;
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
begin;
|
begin;
|
||||||
alter table managershalf drop column "lgID";
|
alter table managershalf drop column "lgID";
|
||||||
alter table managershalf drop column "rank";
|
alter table managershalf drop column "rank";
|
||||||
|
|
||||||
|
update managershalf
|
||||||
|
set teamid = 'WS9'
|
||||||
|
where yearid = 1892 and teamid = 'WAS';
|
||||||
commit;
|
commit;
|
Loading…
Reference in New Issue