add teamcodes table
This commit is contained in:
@@ -342,4 +342,13 @@ CREATE TABLE IF NOT EXISTS "fieldingofsplit" (
|
||||
);
|
||||
|
||||
insert into fieldingofsplit select distinct * from "transformed"."fieldingofsplit";
|
||||
|
||||
create table if not exists teamcodes (
|
||||
"team" text,
|
||||
"franchise" text,
|
||||
primary key("team"),
|
||||
foreign key("franchise") references "franchises"("ID")
|
||||
);
|
||||
|
||||
insert into teamcodes select distinct * from "transformed"."teamcodes";
|
||||
COMMIT;
|
||||
|
||||
18
sql/teamcodes.sql
Normal file
18
sql/teamcodes.sql
Normal file
@@ -0,0 +1,18 @@
|
||||
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;
|
||||
Reference in New Issue
Block a user