lahmanlite/sql/pitching.sql

45 lines
884 B
MySQL
Raw Normal View History

2024-01-26 20:03:29 +00:00
begin;
2024-01-31 06:09:39 +00:00
attach database 'baseball-raw.db' as 'raw';
create temp table pitching as
select * from "raw".pitching;
2024-01-26 20:03:29 +00:00
alter table pitching drop column "lgID";
2024-01-30 03:43:52 +00:00
alter table pitching drop column "teamID";
2024-01-31 06:09:39 +00:00
CREATE TABLE IF NOT EXISTS main."pitching" (
"player" TEXT,
"year" NUMERIC,
"stint" NUMERIC,
"W" NUMERIC,
"L" NUMERIC,
"G" NUMERIC,
"GS" NUMERIC,
"CG" NUMERIC,
"SHO" NUMERIC,
"SV" NUMERIC,
"IPouts" NUMERIC,
"H" NUMERIC,
"ER" NUMERIC,
"HR" NUMERIC,
"BB" NUMERIC,
"SO" NUMERIC,
"BAOpp" NUMERIC,
"ERA" NUMERIC,
"IBB" NUMERIC,
"WP" NUMERIC,
"HBP" NUMERIC,
"BK" NUMERIC,
"BFP" NUMERIC,
"GF" NUMERIC,
"R" NUMERIC,
"SH" NUMERIC,
"SF" NUMERIC,
"GIDP" NUMERIC,
PRIMARY KEY("player","year","stint"),
foreign key("year","player","stint") references "playerstints"("year","player","stint")
);
insert into main.pitching select distinct * from temp."pitching";
2024-01-26 20:03:29 +00:00
commit;