lahmanlite/sql/keys/parks.sql

16 lines
304 B
PL/PgSQL

BEGIN;
CREATE TABLE IF NOT EXISTS "pk_parks" (
"park.key" TEXT,
"park.name" TEXT,
"park.alias" TEXT,
"city" TEXT,
"state" TEXT,
"country" TEXT,
PRIMARY KEY("park.key")
);
INSERT INTO "pk_parks" SELECT DISTINCT * FROM "parks";
DROP TABLE "parks";
ALTER TABLE "pk_parks" RENAME TO "parks";
COMMIT;