![](https://i0.wp.com/niteshkejriwal.com/wp-content/uploads/2014/05/sql-tips-tricks.png?resize=125%2C100&ssl=1)
SQL Script to Create Country Table And Populate With All Country Names
Friends,
In almost all application we use Country field in the database to store the Country of a user/entity. For this, we either use a text box where user enters the country name or provide user with a drop down list of all countries. to create the dropdown, it is advised to store country names in a database table. This post gives you a complete SQL script to create a Country table and populate it with the country names.
CREATE TABLE [dbo].[Country]( [ID] [int] IDENTITY(1,1) NOT NULL, [CountryName] [nvarchar](100) NOT NULL ) ON [PRIMARY] GO SET IDENTITY_INSERT [dbo].[Country] ON GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Afghanistan') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Albania') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Algeria') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'American Samoa') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Andorra') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Angola') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Anguilla') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Antarctica') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Antigua And Barbuda') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Argentina') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Armenia') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Aruba') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Australia') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Austria') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Azerbaijan') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Bahamas') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Bahrain') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Bangladesh') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Barbados') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Belarus') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Belgium') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Belize') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Benin') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Bermuda') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Bhutan') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Bolivia') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Bosnia And Herzegowina') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Botswana') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Bouvet Island') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Brazil') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'British Indian Ocean Territory') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Brunei Darussalam') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Bulgaria') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Burkina Faso') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Burundi') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Cambodia') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Cameroon') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Canada') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Cape Verde') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Cayman Islands') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Central African Republic') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Chad') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Chile') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'China') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Christmas Island') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Cocos (Keeling) Islands') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Colombia') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Comoros') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Congo') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Cook Islands') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Costa Rica') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Cote D''Ivoire') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Croatia (Local Name: Hrvatska)') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Cuba') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Cyprus') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Czech Republic') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Denmark') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Djibouti') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Dominica') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Dominican Republic') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'East Timor') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Ecuador') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Egypt') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'El Salvador') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Equatorial Guinea') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Eritrea') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Estonia') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Ethiopia') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Falkland Islands (Malvinas)') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Faroe Islands') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Fiji') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Finland') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'France') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'French Guiana') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'French Polynesia') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'French Southern Territories') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Gabon') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Gambia') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Georgia') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Germany') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Ghana') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Gibraltar') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Greece') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Greenland') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Grenada') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Guadeloupe') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Guam') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Guatemala') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Guinea') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Guinea-Bissau') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Guyana') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Haiti') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Heard And Mc Donald Islands') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Holy See (Vatican City State)') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Honduras') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Hong Kong') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Hungary') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Iceland') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'India') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Indonesia') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Iran (Islamic Republic Of)') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Iraq') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Ireland') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Israel') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Italy') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Jamaica') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Japan') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Jordan') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Kazakhstan') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Kenya') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Kiribati') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Korea, Dem People''S Republic') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Korea, Republic Of') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Kuwait') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Kyrgyzstan') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Lao People''S Dem Republic') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Latvia') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Lebanon') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Lesotho') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Liberia') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Libyan Arab Jamahiriya') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Liechtenstein') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Lithuania') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Luxembourg') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Macau') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Macedonia') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Madagascar') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Malawi') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Malaysia') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Maldives') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Mali') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Malta') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Marshall Islands') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Martinique') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Mauritania') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Mauritius') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Mayotte') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Mexico') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Micronesia, Federated States') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Moldova, Republic Of') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Monaco') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Mongolia') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Montserrat') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Morocco') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Mozambique') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Myanmar') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Namibia') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Nauru') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Nepal') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Netherlands') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Netherlands Ant Illes') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'New Caledonia') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'New Zealand') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Nicaragua') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Niger') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Nigeria') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Niue') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Norfolk Island') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Northern Mariana Islands') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Norway') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Oman') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Pakistan') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Palau') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Panama') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Papua New Guinea') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Paraguay') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Peru') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Philippines') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Pitcairn') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Poland') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Portugal') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Puerto Rico') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Qatar') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Reunion') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Romania') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Russian Federation') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Rwanda') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Saint K Itts And Nevis') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Saint Lucia') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Saint Vincent, The Grenadines') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Samoa') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'San Marino') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Sao Tome And Principe') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Saudi Arabia') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Senegal') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Seychelles') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Sierra Leone') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Singapore') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Slovakia (Slovak Republic)') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Slovenia') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Solomon Islands') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Somalia') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'South Africa') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'South Georgia , S Sandwich Is.') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Spain') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Sri Lanka') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'St. Helena') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'St. Pierre And Miquelon') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Sudan') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Suriname') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Svalbard, Jan Mayen Islands') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Sw Aziland') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Sweden') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Switzerland') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Syrian Arab Republic') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Taiwan') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Tajikistan') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Tanzania, United Republic Of') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Thailand') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Togo') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Tokelau') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Tonga') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Trinidad And Tobago') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Tunisia') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Turkey') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Turkmenistan') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Turks And Caicos Islands') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Tuvalu') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Uganda') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Ukraine') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'United Arab Emirates') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'United Kingdom') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'United States') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'United States Minor Is.') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Uruguay') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Uzbekistan') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Vanuatu') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Venezuela') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Viet Nam') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Virgin Islands (British)') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Virgin Islands (U.S.)') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Wallis And Futuna Islands') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Western Sahara') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Yemen') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Yugoslavia') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Zaire') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Zambia') GO INSERT [dbo].[Country] ([CountryName]) VALUES (N'Zimbabwe') GO SET IDENTITY_INSERT [dbo].[Country] OFF GO
Keep learning and sharing! Cheers!