lahmanlite/sql/awards.sql

28 lines
474 B
PL/PgSQL

pragma foreign_keys = 0;
begin;
attach database 'baseball-raw.db' as 'raw';
create temp table if not exists "awards" (
"ID" text
);
insert into awards
select distinct awardID
from "raw".awardsmanagers
union
select distinct awardID
from "raw".awardsplayers;
update awards
set id = 'Silver Slugger'
where id = 'SIlver Slugger';
create table if not exists "awards" (
"ID" text,
primary key("ID")
);
insert into main.awards
select distinct * from temp."awards";
commit;