Skip to content

Instantly share code, notes, and snippets.

@dschinkel
Last active April 24, 2022 05:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dschinkel/595d0563565961f144cd599cdecaad8c to your computer and use it in GitHub Desktop.
Save dschinkel/595d0563565961f144cd599cdecaad8c to your computer and use it in GitHub Desktop.
Postgres Dialect | dr5hn / countries-states-cities-database
CREATE TABLE countries (
id integer NOT NULL,
name varchar(100) NOT NULL,
iso3 char(3) DEFAULT NULL,
numeric_code char(3) DEFAULT NULL,
iso2 char(2) DEFAULT NULL,
phonecode varchar(255) DEFAULT NULL,
capital varchar(255) DEFAULT NULL,
currency varchar(255) DEFAULT NULL,
currency_name varchar(255) DEFAULT NULL,
currency_symbol varchar(255) DEFAULT NULL,
tld varchar(255) DEFAULT NULL,
native varchar(255) DEFAULT NULL,
region varchar(255) DEFAULT NULL,
subregion varchar(255) DEFAULT NULL,
timezones text,
translations text,
latitude decimal(10,8) DEFAULT NULL,
longitude decimal(11,8) DEFAULT NULL,
emoji varchar(191) DEFAULT NULL,
emojiU varchar(191) DEFAULT NULL,
created_at timestamp NULL DEFAULT NULL,
updated_at timestamp NOT NULL DEFAULT NULL,
flag smallint NOT NULL DEFAULT '1',
wikiDataId varchar(255) DEFAULT NULL,
PRIMARY KEY (id)
);
CREATE SEQUENCE countries_id_seq;
ALTER TABLE countries
ALTER id
SET DEFAULT NEXTVAL('countries_id_seq');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment