27 lines
514 B
PL/PgSQL
27 lines
514 B
PL/PgSQL
begin;
|
|
attach database 'baseball-raw.db' as 'raw';
|
|
create table if not exists "allstars" (
|
|
"player" text,
|
|
"year" text,
|
|
"gameNum" text,
|
|
"team" text,
|
|
"GP" numeric,
|
|
"gameID" text
|
|
);
|
|
|
|
insert into allstars
|
|
select distinct playerid, yearid, gamenum, teamid, gp, gameid
|
|
from "raw".allstarfull;
|
|
|
|
-- fix game numbers for 1962 all-star games
|
|
update allstars
|
|
set gamenum = 1
|
|
where gameid = 'ALS196207100';
|
|
|
|
update allstars
|
|
set gamenum = 2
|
|
where gameid = 'NLS196207300';
|
|
|
|
alter table allstars drop column "gameid";
|
|
end;
|