2024-02-01 04:43:23 +00:00
|
|
|
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;
|