lahmanlite/sql/leagues.sql

28 lines
544 B
PL/PgSQL

pragma foreign_keys = 0;
begin;
attach database 'baseball-raw.db' as 'raw';
create temp table if not exists "leagues" (
"ID" text,
"name" text
);
insert into leagues values
("NA","National Association"),
("NL","National League"),
("AA","American Association"),
("UA","Union Association"),
("PL","Player's League"),
("AL","American League"),
("FL","Federal League");
create table if not exists main."leagues" (
"ID" text,
"name" text,
primary key("ID")
);
insert into main.leagues select distinct * from temp."leagues";
commit;