2024-01-26 00:48:11 +00:00
|
|
|
begin;
|
|
|
|
CREATE TABLE IF NOT EXISTS "pk_batting" (
|
|
|
|
"playerID" TEXT,
|
|
|
|
"yearID" NUMERIC,
|
|
|
|
"stint" NUMERIC,
|
|
|
|
"teamID" TEXT,
|
|
|
|
"lgID" TEXT,
|
|
|
|
"G" NUMERIC,
|
|
|
|
"AB" NUMERIC,
|
|
|
|
"R" NUMERIC,
|
|
|
|
"H" NUMERIC,
|
|
|
|
"2B" NUMERIC,
|
|
|
|
"3B" NUMERIC,
|
|
|
|
"HR" NUMERIC,
|
|
|
|
"RBI" NUMERIC,
|
|
|
|
"SB" NUMERIC,
|
|
|
|
"CS" NUMERIC,
|
|
|
|
"BB" NUMERIC,
|
|
|
|
"SO" NUMERIC,
|
|
|
|
"IBB" NUMERIC,
|
|
|
|
"HBP" NUMERIC,
|
|
|
|
"SH" NUMERIC,
|
|
|
|
"SF" NUMERIC,
|
|
|
|
"GIDP" NUMERIC,
|
2024-01-26 01:49:08 +00:00
|
|
|
PRIMARY KEY("playerID","yearID","stint","teamID"),
|
2024-01-26 01:59:14 +00:00
|
|
|
foreign key("playerID") references "people"("playerID")
|
2024-01-26 00:48:11 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
INSERT INTO "pk_batting" SELECT DISTINCT * FROM "batting";
|
|
|
|
DROP TABLE "batting";
|
|
|
|
ALTER TABLE "pk_batting" RENAME TO "batting";
|
|
|
|
commit;
|