2024-02-01 04:43:23 +00:00
|
|
|
pragma foreign_keys = 0;
|
|
|
|
|
2024-01-28 06:09:06 +00:00
|
|
|
begin;
|
|
|
|
attach database 'baseball-raw.db' as 'raw';
|
|
|
|
|
2024-01-31 06:09:39 +00:00
|
|
|
create temp table if not exists appearancespost (
|
2024-01-28 06:09:06 +00:00
|
|
|
"year" numeric,
|
|
|
|
"player" text,
|
|
|
|
"team" text
|
|
|
|
);
|
|
|
|
|
|
|
|
insert into appearancespost
|
|
|
|
select distinct yearID, playerID, teamID
|
|
|
|
from 'raw'.battingpost
|
|
|
|
union
|
|
|
|
select distinct yearID, playerID, teamID
|
|
|
|
from 'raw'.pitchingpost
|
|
|
|
union
|
|
|
|
select distinct yearID, playerID, teamID
|
|
|
|
from 'raw'.fieldingpost;
|
2024-01-31 06:09:39 +00:00
|
|
|
|
|
|
|
create table if not exists appearancespost (
|
|
|
|
"year" numeric,
|
|
|
|
"player" text,
|
|
|
|
"team" text,
|
|
|
|
primary key("year","player"),
|
|
|
|
foreign key("player") references "people"("ID"),
|
|
|
|
foreign key("year","team") references "teamseasons"("year","team")
|
|
|
|
);
|
|
|
|
|
|
|
|
insert into main.appearancespost select distinct * from temp."appearancespost";
|
2024-01-28 06:09:06 +00:00
|
|
|
commit;
|