lahmanlite/sql/awardsmanagers.sql

24 lines
613 B
MySQL
Raw Normal View History

pragma foreign_keys = 0;
2024-01-27 03:34:13 +00:00
begin;
2024-05-05 03:11:20 +00:00
attach database 'lahman-raw.db' as 'raw';
2024-01-31 06:09:39 +00:00
create temp table "awardsmanagers" as
select * from "raw".awardsmanagers;
alter table temp.awardsmanagers drop column "tie";
CREATE TABLE IF NOT EXISTS main."awardsmanagers" (
"manager" TEXT,
"award" TEXT,
"year" NUMERIC,
"league" TEXT,
"notes" TEXT,
PRIMARY KEY("manager","award","year","league"),
foreign key("manager") references "people"("ID"),
foreign key("award","year","league") references "yearlyawards"("award","year","league")
);
insert into main.awardsmanagers select distinct * from temp."awardsmanagers";
2024-01-27 03:34:13 +00:00
commit;