lahmanlite/sql/awardsplayers.sql

27 lines
697 B
MySQL
Raw Normal View History

pragma foreign_keys = 0;
2024-01-27 18:10:48 +00:00
begin;
2024-01-31 06:09:39 +00:00
attach database 'baseball-raw.db' as 'raw';
create temp table awardsplayers as
select * from "raw".awardsplayers;
alter table temp.awardsplayers drop column "tie";
2024-03-17 04:37:42 +00:00
update awardsplayers
set awardid = 'Silver Slugger'
where awardid = 'SIlver Slugger';
2024-01-31 06:09:39 +00:00
CREATE TABLE IF NOT EXISTS main."awardsplayers" (
"player" TEXT,
"award" TEXT,
"year" NUMERIC,
"league" TEXT,
"notes" TEXT,
PRIMARY KEY("award","year","league","notes","player"),
foreign key("player") references "people"("ID"),
foreign key("award","year","league") references "yearlyawards"("award","year","league")
);
insert into main.awardsplayers select distinct * from temp.awardsplayers;
2024-01-27 18:10:48 +00:00
commit;