lahmanlite/sql/awardsplayers.sql

23 lines
610 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";
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;