lahmanlite/sql/people.sql

33 lines
627 B
PL/PgSQL

BEGIN;
attach database 'baseball-raw.db' as 'raw';
CREATE TABLE "people" (
"playerID" text,
"birthYear" NUMERIC,
"birthMonth" NUMERIC,
"birthDay" NUMERIC,
"birthCountry" text,
"birthState" text,
"birthCity" text,
"deathYear" text,
"deathMonth" text,
"deathDay" text,
"deathCountry" text,
"deathState" text,
"deathCity" text,
"nameFirst" text,
"nameLast" text,
"nameGiven" text,
"weight" NUMERIC,
"height" NUMERIC,
"bats" text,
"throws" text,
"debut" text,
"finalGame" text,
"retroID" text,
"bbrefID" text,
primary key("playerID")
);
INSERT INTO "people" SELECT DISTINCT * FROM "raw"."people";
COMMIT;