The following SQL scripts below create the standard country and country code.

  • Includes most of if not all countries (238) as according to ISO and standards bodies
  • Provides a country code (US), and the country in full (United States Of America), properly escaped.
  • Runs in MySQL DBMS

I have sticked to using (and updating/refining the list) for most production settings.

Correct and current as of October 8, 2010.

# Dumping structure for table abc.country_matrix
DROP TABLE IF EXISTS `country_matrix`;
CREATE TABLE IF NOT EXISTS `country_matrix` (
`country_id` smallint(5) unsigned NOT NULL,
`country` varchar(100) NOT NULL,
`country_code` varchar(2) NOT NULL,
PRIMARY KEY (`country_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

# Dumping data for table abc.country_matrix: 238 rows
/*!40000 ALTER TABLE `country_matrix` DISABLE KEYS */;
INSERT INTO `country_matrix` (`country_id`, `country`, `country_code`) VALUES (1, ‘Singapore’, ‘SG’), (2, ‘China’, ‘CN’), (3, ‘Malaysia’, ‘MY’), (4, ‘United States’, ‘US’), (5, ‘Canada’, ‘CA’), (6, ‘Albania’, ‘AL’), (7, ‘Algeria’, ‘DZ’), (8, ‘Amerin Samoa’, ‘DS’), (9, ‘Andorra’, ‘AD’), (10, ‘Angola’, ‘AO’), (11, ‘Anguilla’, ‘AI’), (12, ‘Antarctica’, ‘AQ’), (13, ‘Antigua and/or Barbuda’, ‘AG’), (14, ‘Argentina’, ‘AR’), (15, ‘Armenia’, ‘AM’), (16, ‘Aruba’, ‘AW’), (17, ‘Austria’, ‘AT’), (18, ‘Azerbaijan’, ‘AZ’), (19, ‘Bahamas’, ‘BS’), (20, ‘Bahrain’, ‘BH’), (21, ‘Bangladesh’, ‘BD’), (22, ‘Barbados’, ‘BB’), (23, ‘Belarus’, ‘BY’), (24, ‘Belgium’, ‘BE’), (25, ‘Belize’, ‘BZ’), (26, ‘Benin’, ‘BJ’), (27, ‘Bermuda’, ‘BM’), (28, ‘Bhutan’, ‘BT’), (29, ‘Bolivia’, ‘BO’), (30, ‘Bosnia and Herzegovina’, ‘BA’), (31, ‘Botswana’, ‘BW’), (32, ‘Bouvet Island’, ‘BV’), (33, ‘Brazil’, ‘BR’), (34, ‘British lndian Ocean Territory’, ‘IO’), (35, ‘Brunei Darussalam’, ‘BN’), (36, ‘Bulgaria’, ‘BG’), (37, ‘Burkina Faso’, ‘BF’), (38, ‘Burundi’, ‘BI’), (39, ‘Cambodia’, ‘KH’), (40, ‘Cameroon’, ‘CM’), (41, ‘Cape Verde’, ‘CV’), (42, ‘Cayman Islands’, ‘KY’), (43, ‘Central African Republic’, ‘CF’), (44, ‘Chad’, ‘TD’), (45, ‘Chile’, ‘CL’), (46, ‘Christmas Island’, ‘CX’), (47, ‘Cocos (Keeling) Islands’, ‘CC’), (48, ‘Colombia’, ‘CO’), (49, ‘Comoros’, ‘KM’), (50, ‘Congo’, ‘CG’), (51, ‘Cook Islands’, ‘CK’), (52, ‘Costa Rica’, ‘CR’), (53, ‘Croatia (Hrvatska)’, ‘HR’), (54, ‘Cuba’, ‘CU’), (55, ‘Cyprus’, ‘CY’), (56, ‘Czech Republic’, ‘CZ’), (57, ‘Denmark’, ‘DK’), (58, ‘Djibouti’, ‘DJ’), (59, ‘Dominica’, ‘DM’), (60, ‘Dominican Republic’, ‘DO’), (61, ‘East Timor’, ‘TP’), (62, ‘Ecudaor’, ‘EC’), (63, ‘Egypt’, ‘EG’), (64, ‘El Salvador’, ‘SV’), (65, ‘Equatorial Guinea’, ‘GQ’), (66, ‘Eritrea’, ‘ER’), (67, ‘Estonia’, ‘EE’), (68, ‘Ethiopia’, ‘ET’), (69, ‘Falkland Islands (Malvinas)’, ‘FK’), (70, ‘Faroe Islands’, ‘FO’), (71, ‘Fiji’, ‘FJ’), (72, ‘Finland’, ‘FI’), (73, ‘France’, ‘FR’), (74, ‘France, Metropolitan’, ‘FX’), (75, ‘French Guiana’, ‘GF’), (76, ‘French Polynesia’, ‘PF’), (77, ‘French Southern Territories’, ‘TF’), (78, ‘Gabon’, ‘GA’), (79, ‘Gambia’, ‘GM’), (80, ‘Georgia’, ‘GE’), (81, ‘Germany’, ‘DE’), (82, ‘Ghana’, ‘GH’), (83, ‘Gibraltar’, ‘GI’), (84, ‘Greece’, ‘GR’), (85, ‘Greenland’, ‘GL’), (86, ‘Grenada’, ‘GD’), (87, ‘Guadeloupe’, ‘GP’), (88, ‘Guam’, ‘GU’), (89, ‘Guatemala’, ‘GT’), (90, ‘Guinea’, ‘GN’), (91, ‘Guinea-Bissau’, ‘GW’), (92, ‘Guyana’, ‘GY’), (93, ‘Haiti’, ‘HT’), (94, ‘Heard and Mc Donald Islands’, ‘HM’), (95, ‘Honduras’, ‘HN’), (96, ‘Hong Kong’, ‘HK’), (97, ‘Hungary’, ‘HU’), (98, ‘Iceland’, ‘IS’), (99, ‘India’, ‘IN’), (100, ‘Indonesia’, ‘ID’), (101, ‘Iran (Islamic Republic of)’, ‘IR’), (102, ‘Iraq’, ‘IQ’), (103, ‘Ireland’, ‘IE’), (104, ‘Israel’, ‘IL’), (105, ‘Italy’, ‘IT’), (106, ‘Ivory Coast’, ‘CI’), (107, ‘Jamaica’, ‘JM’), (108, ‘Japan’, ‘JP’), (109, ‘Jordan’, ‘JO’), (110, ‘Kazakhstan’, ‘KZ’), (111, ‘Kenya’, ‘KE’), (112, ‘Kiribati’, ‘KI’), (113, ‘Korea, Democratic People\’\’\’\’s Republic of’, ‘KP’), (114, ‘Korea, Republic of’, ‘KR’), (115, ‘Kuwait’, ‘KW’), (116, ‘Kyrgyzstan’, ‘KG’), (117, ‘Lao People\’\’\’\’s Democratic Republic’, ‘LA’), (118, ‘Latvia’, ‘LV’), (119, ‘Lebanon’, ‘LB’), (120, ‘Lesotho’, ‘LS’), (121, ‘Liberia’, ‘LR’), (122, ‘Libyan Arab Jamahiriya’, ‘LY’), (123, ‘Liechtenstein’, ‘LI’), (124, ‘Lithuania’, ‘LT’), (125, ‘Luxembourg’, ‘LU’), (126, ‘Macau’, ‘MO’), (127, ‘Macedonia’, ‘MK’), (128, ‘Madagascar’, ‘MG’), (129, ‘Malawi’, ‘MW’), (130, ‘New Zealand’, ‘NZ’), (131, ‘Maldives’, ‘MV’), (132, ‘Mali’, ‘ML’), (133, ‘Malta’, ‘MT’), (134, ‘Marshall Islands’, ‘MH’), (135, ‘Martinique’, ‘MQ’), (136, ‘Mauritania’, ‘MR’), (137, ‘Mauritius’, ‘MU’), (138, ‘Mayotte’, ‘TY’), (139, ‘Mexico’, ‘MX’), (140, ‘Micronesia, Federated States of’, ‘FM’), (141, ‘Moldova, Republic of’, ‘MD’), (142, ‘Monaco’, ‘MC’), (143, ‘Mongolia’, ‘MN’), (144, ‘Montserrat’, ‘MS’), (145, ‘Morocco’, ‘MA’), (146, ‘Mozambique’, ‘MZ’), (147, ‘Myanmar’, ‘MM’), (148, ‘Namibia’, ‘NA’), (149, ‘Nauru’, ‘NR’), (150, ‘Nepal’, ‘NP’), (151, ‘Netherlands’, ‘NL’), (152, ‘Netherlands Antilles’, ‘AN’), (153, ‘New Caledonia’, ‘NC’), (154, ‘Nicaragua’, ‘NI’), (155, ‘Niger’, ‘NE’), (156, ‘Nigeria’, ‘NG’), (157, ‘Niue’, ‘NU’), (158, ‘Norfork Island’, ‘NF’), (159, ‘Northern Mariana Islands’, ‘MP’), (160, ‘Norway’, ‘NO’), (161, ‘Oman’, ‘OM’), (162, ‘Pakistan’, ‘PK’), (163, ‘Palau’, ‘PW’), (164, ‘Panama’, ‘PA’), (165, ‘Papua New Guinea’, ‘PG’), (166, ‘Paraguay’, ‘PY’), (167, ‘Peru’, ‘PE’), (168, ‘Philippines’, ‘PH’), (169, ‘Pitcairn’, ‘PN’), (170, ‘Poland’, ‘PL’), (171, ‘Portugal’, ‘PT’), (172, ‘Puerto Rico’, ‘PR’), (173, ‘Qatar’, ‘QA’), (174, ‘Reunion’, ‘RE’), (175, ‘Romania’, ‘RO’), (176, ‘Russian Federation’, ‘RU’), (177, ‘Rwanda’, ‘RW’), (178, ‘Saint Kitts and Nevis’, ‘KN’), (179, ‘Saint Lucia’, ‘LC’), (180, ‘Saint Vincent and the Grenadines’, ‘VC’), (181, ‘Samoa’, ‘WS’), (182, ‘San Marino’, ‘SM’), (183, ‘Sao Tome and Principe’, ‘ST’), (184, ‘Saudi Arabia’, ‘SA’), (185, ‘Senegal’, ‘SN’), (186, ‘Seychelles’, ‘SC’), (187, ‘Sierra Leone’, ‘SL’), (188, ‘Slovakia’, ‘SK’), (189, ‘Slovenia’, ‘SI’), (190, ‘Solomon Islands’, ‘SB’), (191, ‘Somalia’, ‘SO’), (192, ‘South Africa’, ‘ZA’), (193, ‘South Georgia South Sandwich Islands’, ‘GS’), (194, ‘Spain’, ‘ES’), (195, ‘Sri Lanka’, ‘LK’), (196, ‘St. Helena’, ‘SH’), (197, ‘St. Pierre and Miquelon’, ‘PM’), (198, ‘Sudan’, ‘SD’), (199, ‘Suriname’, ‘SR’), (200, ‘Svalbarn and Jan Mayen Islands’, ‘SJ’), (201, ‘Swaziland’, ‘SZ’), (202, ‘Sweden’, ‘SE’), (203, ‘Switzerland’, ‘CH’), (204, ‘Syrian Arab Republic’, ‘SY’), (205, ‘Taiwan’, ‘TW’), (206, ‘Tajikistan’, ‘TJ’), (207, ‘Tanzania, United Republic of’, ‘TZ’), (208, ‘Thailand’, ‘TH’), (209, ‘Togo’, ‘TG’), (210, ‘Tokelau’, ‘TK’), (211, ‘Tonga’, ‘TO’), (212, ‘Trinidad and Tobago’, ‘TT’), (213, ‘Tunisia’, ‘TN’), (214, ‘Turkey’, ‘TR’), (215, ‘Turkmenistan’, ‘TM’), (216, ‘Turks and Caicos Islands’, ‘TC’), (217, ‘Tuvalu’, ‘TV’), (218, ‘Uganda’, ‘UG’), (219, ‘Ukraine’, ‘UA’), (220, ‘United Arab Emirates’, ‘AE’), (221, ‘United Kingdom’, ‘GB’), (222, ‘Australia’, ‘AU’), (223, ‘Uruguay’, ‘UY’), (224, ‘Uzbekistan’, ‘UZ’), (225, ‘Vanuatu’, ‘VU’), (226, ‘Vatican City State’, ‘VA’), (227, ‘Venezuela’, ‘VE’), (228, ‘Vietnam’, ‘VN’), (229, ‘Virigan Islands (British)’, ‘VG’), (230, ‘Virgin Islands (U.S.)’, ‘VI’), (231, ‘Wallis and Futuna Islands’, ‘WF’), (232, ‘Western Sahara’, ‘EH’), (233, ‘Yemen’, ‘YE’), (234, ‘Yugoslavia’, ‘YU’), (235, ‘Zaire’, ‘ZR’), (236, ‘Zambia’, ‘ZM’), (237, ‘Zimbabwe’, ‘ZW’), (238, ‘Afghanistan’, ‘AF’);

Share