lahmanlite/sql/keys/schools.sql

15 lines
296 B
PL/PgSQL

BEGIN;
CREATE TABLE IF NOT EXISTS "pk_schools" (
"schoolID" TEXT,
"name_full" TEXT,
"city" TEXT,
"state" TEXT,
"country" TEXT,
PRIMARY KEY("schoolID")
);
INSERT INTO "pk_schools" SELECT DISTINCT * FROM "schools";
DROP TABLE "schools";
ALTER TABLE "pk_schools" RENAME TO "schools";
COMMIT;