Posts

Showing posts with the label All Country name with code

SQL - ISO Country Names and Codes

SQL - ISO Country Names and Codes This document provides the necessary SQL statements for ISO 3166 country names and two and three letter codes. This page and the data are in UTF-8 encoding. Create Country Table Table is called base_country as it follows Edoceo naming conventions, change as necessary. This is for a PostgreSQL database, CREATE TABLE statements may need to be altered for your RDBMS. create table base_country ( id integer primary key, iso2 char(2), iso3 char(3), name_en varchar(64), name_fr varchar(64), name_de varchar(64) ); Create indexes as necessary, which may not be as this table is so small. Insert the Country Data This SQL should work on any SQL-99 compliant RDBMS. INSERT INTO base_country (id, iso2, iso3, name_en, name_fr) VALUES (1, 'AF', 'AFG', 'Afghanistan', NULL); INSERT INTO base_country (id, iso2, iso3, name_en, name_fr) VALUES (2, 'AX', 'ALA', 'Ă…land Islands', NULL); INSERT INTO ba