lahmanlite/sql/teams.sql

19 lines
337 B
PL/PgSQL

begin;
attach database 'baseball-raw.db' as 'raw';
create table if not exists teams (
"ID" text,
"franchise" text
);
insert into teams
select distinct teamid, franchid from "raw"."teams";
update teams
set ID = 'WS9'
where ID = 'WAS' and franchise = 'WAS';
update teams
set ID = 'PHP'
where ID = 'PH4' and franchise = 'PHQ';
commit;