more 2024 adjustments
This commit is contained in:
parent
c643396e41
commit
90b6da3fd9
|
@ -6,15 +6,15 @@ attach database 'baseball-raw.db' as 'raw';
|
||||||
create temp table homegames as
|
create temp table homegames as
|
||||||
select * from "raw".homegames;
|
select * from "raw".homegames;
|
||||||
|
|
||||||
alter table "homegames" drop column "league.key";
|
alter table "homegames" drop column "leaguekey";
|
||||||
|
|
||||||
update homegames
|
update homegames
|
||||||
set "team.key" = 'WS9'
|
set "teamkey" = 'WS9'
|
||||||
where "team.key" = 'WAS' and "year.key" between 1891 and 1899;
|
where "teamkey" = 'WAS' and "yearkey" between 1891 and 1899;
|
||||||
|
|
||||||
update homegames
|
update homegames
|
||||||
set "team.key" = 'PHP'
|
set "teamkey" = 'PHP'
|
||||||
where "team.key" = 'PH4' and "year.key" between 1890 and 1891;
|
where "teamkey" = 'PH4' and "yearkey" between 1890 and 1891;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS main."homegames" (
|
CREATE TABLE IF NOT EXISTS main."homegames" (
|
||||||
"year" NUMERIC,
|
"year" NUMERIC,
|
||||||
|
|
|
@ -6,14 +6,8 @@ attach database 'baseball-raw.db' as 'raw';
|
||||||
create temp table parks as
|
create temp table parks as
|
||||||
select * from "raw".parks;
|
select * from "raw".parks;
|
||||||
|
|
||||||
alter table parks drop column "park.alias";
|
alter table parks drop column "ID";
|
||||||
|
alter table parks drop column "parkalias";
|
||||||
-- insert some missing parks
|
|
||||||
insert into parks values
|
|
||||||
('ARL03', 'Globe Life Field', 'Arlington', 'TX', 'US'),
|
|
||||||
('BUF05', 'Sahlen Field', 'Buffalo', 'NY', 'US'),
|
|
||||||
('DUN01', 'TD Ballpark', 'Dunedin', 'FL', 'US'),
|
|
||||||
('DYE01', 'Field of Dreams', 'Dyersville', 'IA', 'US');
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS main."parks" (
|
CREATE TABLE IF NOT EXISTS main."parks" (
|
||||||
"ID" TEXT,
|
"ID" TEXT,
|
||||||
|
@ -24,5 +18,5 @@ CREATE TABLE IF NOT EXISTS main."parks" (
|
||||||
PRIMARY KEY("ID")
|
PRIMARY KEY("ID")
|
||||||
);
|
);
|
||||||
|
|
||||||
insert into main.parks select distinct * from temp."parks";
|
insert into main.parks select distinct "parkkey", "parkname", "city", "state", "country" from temp."parks";
|
||||||
commit;
|
commit;
|
||||||
|
|
|
@ -6,12 +6,16 @@ attach database 'baseball-raw.db' as 'raw';
|
||||||
create temp table people as
|
create temp table people as
|
||||||
select * from "raw".people;
|
select * from "raw".people;
|
||||||
|
|
||||||
|
alter table people drop column "ID";
|
||||||
|
|
||||||
-- insert some missing people
|
-- insert some missing people
|
||||||
insert into people values
|
insert into people values
|
||||||
('millema99', 1917, 4, 14, 'USA', 'NY', 'Brooklyn', 2012, 11, 27, 'USA', 'NY', 'Manhattan', 'Marvin', 'Miller', 'Marvin Julian', null, null, null, null, null, null, null, 'millema99'),
|
|
||||||
('fowlebu99', 1858, 3, 16, 'USA', 'NY', 'Fort Plain', 1913, 2, 26, 'USA', 'NY', 'Frankfort', 'Bud', 'Fowler', 'John W. Jackson', 155, 67, 'R', 'R', null, null, null, 'fowlebu99'),
|
('fowlebu99', 1858, 3, 16, 'USA', 'NY', 'Fort Plain', 1913, 2, 26, 'USA', 'NY', 'Frankfort', 'Bud', 'Fowler', 'John W. Jackson', 155, 67, 'R', 'R', null, null, null, 'fowlebu99'),
|
||||||
('thompan01', null, null, null, null, null, null, null, null, null, null, null, null, null, 'Thompson', null, null, null, null, null, '1875-04-26', '1875-05-17', null, 'thompan01');
|
('thompan01', null, null, null, null, null, null, null, null, null, null, null, null, null, 'Thompson', null, null, null, null, null, '1875-04-26', '1875-05-17', null, 'thompan01');
|
||||||
|
|
||||||
|
delete from people
|
||||||
|
where playerID = 'kellyho99';
|
||||||
|
|
||||||
update people
|
update people
|
||||||
set
|
set
|
||||||
birthcountry = nullif(birthcountry, ''),
|
birthcountry = nullif(birthcountry, ''),
|
||||||
|
@ -61,9 +65,9 @@ CREATE TABLE main."people" (
|
||||||
"bats" text check ("bats" in ('L','R','B')),
|
"bats" text check ("bats" in ('L','R','B')),
|
||||||
"throws" text check ("throws" in ('L','R','B')),
|
"throws" text check ("throws" in ('L','R','B')),
|
||||||
"debut" text check (unixepoch("debut") <= unixepoch("finalGame")),
|
"debut" text check (unixepoch("debut") <= unixepoch("finalGame")),
|
||||||
|
"bbrefID" text unique,
|
||||||
"finalGame" text,
|
"finalGame" text,
|
||||||
"retroID" text unique,
|
"retroID" text unique,
|
||||||
"bbrefID" text unique,
|
|
||||||
primary key("ID")
|
primary key("ID")
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue