lahmanlite/sql/keys/appearances.sql

32 lines
676 B
MySQL
Raw Normal View History

2024-01-26 00:48:11 +00:00
begin;
CREATE TABLE IF NOT EXISTS "pk_appearances" (
"yearID" NUMERIC,
"teamID" TEXT,
"lgID" TEXT,
"playerID" TEXT,
"G_all" NUMERIC,
"GS" NUMERIC,
"G_batting" NUMERIC,
"G_defense" NUMERIC,
"G_p" NUMERIC,
"G_c" NUMERIC,
"G_1b" NUMERIC,
"G_2b" NUMERIC,
"G_3b" NUMERIC,
"G_ss" NUMERIC,
"G_lf" NUMERIC,
"G_cf" NUMERIC,
"G_rf" NUMERIC,
"G_of" NUMERIC,
"G_dh" NUMERIC,
"G_ph" NUMERIC,
"G_pr" NUMERIC,
2024-01-26 01:49:08 +00:00
PRIMARY KEY("yearID","teamID","playerID"),
foreign key("playerID") references "people"("playerID")
2024-01-26 00:48:11 +00:00
);
INSERT INTO "pk_appearances" SELECT DISTINCT * FROM "appearances";
DROP TABLE "appearances";
ALTER TABLE "pk_appearances" RENAME TO "appearances";
commit;