2024-02-01 04:43:23 +00:00
|
|
|
pragma foreign_keys = 0;
|
|
|
|
|
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;
|