lahmanlite/sql/awardssharemanagers.sql

21 lines
577 B
MySQL
Raw Normal View History

pragma foreign_keys = 0;
2024-01-31 06:09:39 +00:00
begin;
attach database 'baseball-raw.db' as 'raw';
CREATE TABLE IF NOT EXISTS "awardssharemanagers" (
"award" TEXT,
"year" NUMERIC,
"league" TEXT,
"manager" TEXT,
2024-02-02 02:48:12 +00:00
"pointsWon" NUMERIC check (pointsWon <= pointsMax),
2024-01-31 06:09:39 +00:00
"pointsMax" NUMERIC,
"votesFirst" NUMERIC,
PRIMARY KEY("manager","award","year","league"),
foreign key("manager") references "people"("ID"),
foreign key("award","year","league") references "yearlyawards"("award","year","league")
);
insert into awardssharemanagers select distinct * from "raw"."awardssharemanagers";
commit;