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
|
||||
select * from "raw".homegames;
|
||||
|
||||
alter table "homegames" drop column "league.key";
|
||||
alter table "homegames" drop column "leaguekey";
|
||||
|
||||
update homegames
|
||||
set "team.key" = 'WS9'
|
||||
where "team.key" = 'WAS' and "year.key" between 1891 and 1899;
|
||||
set "teamkey" = 'WS9'
|
||||
where "teamkey" = 'WAS' and "yearkey" between 1891 and 1899;
|
||||
|
||||
update homegames
|
||||
set "team.key" = 'PHP'
|
||||
where "team.key" = 'PH4' and "year.key" between 1890 and 1891;
|
||||
set "teamkey" = 'PHP'
|
||||
where "teamkey" = 'PH4' and "yearkey" between 1890 and 1891;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS main."homegames" (
|
||||
"year" NUMERIC,
|
||||
|
|
|
@ -6,14 +6,8 @@ attach database 'baseball-raw.db' as 'raw';
|
|||
create temp table parks as
|
||||
select * from "raw".parks;
|
||||
|
||||
alter table parks drop column "park.alias";
|
||||
|
||||
-- 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');
|
||||
alter table parks drop column "ID";
|
||||
alter table parks drop column "parkalias";
|
||||
|
||||
CREATE TABLE IF NOT EXISTS main."parks" (
|
||||
"ID" TEXT,
|
||||
|
@ -24,5 +18,5 @@ CREATE TABLE IF NOT EXISTS main."parks" (
|
|||
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;
|
||||
|
|
|
@ -6,12 +6,16 @@ attach database 'baseball-raw.db' as 'raw';
|
|||
create temp table people as
|
||||
select * from "raw".people;
|
||||
|
||||
alter table people drop column "ID";
|
||||
|
||||
-- insert some missing people
|
||||
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'),
|
||||
('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
|
||||
set
|
||||
birthcountry = nullif(birthcountry, ''),
|
||||
|
@ -61,9 +65,9 @@ CREATE TABLE main."people" (
|
|||
"bats" text check ("bats" in ('L','R','B')),
|
||||
"throws" text check ("throws" in ('L','R','B')),
|
||||
"debut" text check (unixepoch("debut") <= unixepoch("finalGame")),
|
||||
"bbrefID" text unique,
|
||||
"finalGame" text,
|
||||
"retroID" text unique,
|
||||
"bbrefID" text unique,
|
||||
primary key("ID")
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in New Issue