ISO-3166-1 Country List as SQL Script

How often do you need a drop-down in your application that displays all countries? And in most cases you need it in more than one language, right. I’ve been there a couple of times and finally decided to publish an sql script that could be used to create a countries table and fill it with all countries according to ISO-3166-1.

It took me some time to scan different sources and create my own countries.sql. And that was the main reason for setting up this post, I couldn’t find a page or blog post that had a ready-to-apply SQL script. When I was looking for the spanish translations, I finally stumbled upon Mega Database and its wonderful lists of everything. So you can either go to their page and get your own export of the data, or simply download the script I have attached to this post.

Thanks to http://www.mega-db.com.ar for the lists and enjoy displaying those country drop-downs.

Advertisements

4 comments on “ISO-3166-1 Country List as SQL Script

  1. Hey, very nice site. I came across this on Google, and I am stoked that I did. I will definately be coming back here more often. Wish I could add to the conversation and bring a bit more to the table, but am just taking in as much info as I can at the moment.

  2. You need to add this line to your file
    INSERT INTO country (id, iso3, iso2, english, german, spanish, french, italian, portuguese) VALUES (”, ‘RUS’, ‘RU’, ‘Russian Federation’, ‘Russische Föderation’, ‘Federación Rusa’, ‘Fédération de Russie’, ‘Federazione Russa’, ‘Federação da Rússia’);

  3. Thanks a lot!!

    I’ve used it to create the SQL Server table, with little modifications to de script, if you want it I can give it to you.. thanks again 😉

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s