lahmanlite/sql/schools.sql

25 lines
539 B
PL/PgSQL

pragma foreign_keys = 0;
begin;
attach database 'baseball-raw.db' as 'raw';
create temp table schools as
select * from "raw".schools;
-- insert some missing schools
insert into schools values
('txutper', 'University of Texas Permian Basin', 'Odessa', 'TX', 'USA'),
('txrange', 'Ranger College', 'Ranger', 'TX', 'USA');
CREATE TABLE IF NOT EXISTS main."schools" (
"ID" TEXT,
"name_full" TEXT,
"city" TEXT,
"state" TEXT,
"country" TEXT,
PRIMARY KEY("ID")
);
insert into main.schools select distinct * from temp."schools";
commit;