begin;
attach database 'baseball-raw.db' as 'raw';
create table if not exists teamcodes (
	"team"	text,
	"franchise"	text
);

insert into teamcodes
select distinct teamid, franchid from "raw"."teams";

update teamcodes
set team = 'WS9'
where team = 'WAS' and franchise = 'WAS';

update teamcodes
set team = 'PHP'
where team = 'PH4' and franchise = 'PHQ';
commit;
