lahmanlite/sql/salaries.sql

21 lines
502 B
MySQL
Raw Normal View History

2024-01-26 19:27:58 +00:00
begin;
2024-01-31 06:09:39 +00:00
attach database 'baseball-raw.db' as 'raw';
create temp table salaries as
select * from "raw".salaries;
2024-01-26 19:27:58 +00:00
alter table "salaries" drop column "lgID";
2024-01-31 06:09:39 +00:00
CREATE TABLE IF NOT EXISTS main."salaries" (
"year" NUMERIC,
"team" TEXT,
"player" TEXT,
"salary" NUMERIC,
PRIMARY KEY("year","player","team"),
foreign key("player") references "people"("ID"),
foreign key("year","team") references "teamseasons"("year","team")
);
insert into main.salaries select distinct * from temp."salaries";
2024-01-26 19:27:58 +00:00
commit;