lahmanlite/sql/keys/salaries.sql

16 lines
381 B
MySQL
Raw Normal View History

2024-01-26 00:48:11 +00:00
BEGIN;
CREATE TABLE IF NOT EXISTS "pk_salaries" (
"yearID" NUMERIC,
"teamID" TEXT,
"lgID" TEXT,
"playerID" TEXT,
"salary" NUMERIC,
2024-01-26 01:49:08 +00:00
PRIMARY KEY("yearID","playerID","teamID"),
foreign key("playerID") references "people"("playerID")
2024-01-26 00:48:11 +00:00
);
INSERT INTO "pk_salaries" SELECT DISTINCT * FROM "salaries";
DROP TABLE "salaries";
ALTER TABLE "pk_salaries" RENAME TO "salaries";
COMMIT;