add yearlyawards table
This commit is contained in:
11
sql/load.sql
11
sql/load.sql
@@ -534,4 +534,15 @@ CREATE TABLE IF NOT EXISTS "awardsshareplayers" (
|
||||
);
|
||||
|
||||
insert into awardsshareplayers select distinct * from "transformed"."awardsshareplayers";
|
||||
|
||||
create table if not exists "yearlyawards" (
|
||||
"year" numeric,
|
||||
"award" text,
|
||||
"league" text,
|
||||
primary key("year","award","league"),
|
||||
foreign key("year") references "seasons"("year"),
|
||||
foreign key("award") references "awards"("ID")
|
||||
);
|
||||
|
||||
insert into yearlyawards select distinct * from "transformed"."yearlyawards";
|
||||
COMMIT;
|
||||
|
||||
15
sql/yearlyawards.sql
Normal file
15
sql/yearlyawards.sql
Normal file
@@ -0,0 +1,15 @@
|
||||
begin;
|
||||
attach database 'baseball-raw.db' as 'raw';
|
||||
create table if not exists "yearlyawards" (
|
||||
"year" numeric,
|
||||
"award" text,
|
||||
"league" text
|
||||
);
|
||||
|
||||
insert into yearlyawards
|
||||
select distinct yearid, awardid, lgID
|
||||
from "raw".awardsmanagers
|
||||
union
|
||||
select distinct yearid, awardid, lgID
|
||||
from "raw".awardsplayers;
|
||||
commit;
|
||||
Reference in New Issue
Block a user