Tag Archive | SQL

Get countries – World `countries` in MySQL or XML format


After my post from yesterday evening, WordPress analytics are telling me that almost 13,000 views (mostly from Hackernews) have seen that post in less then 24 hours. I don’t know about you, but for me, this is pretty amazing, and I’m very thankful.

To prove you that, I’ve made an upgrade to my script, and now you can get world countries in MySQL or XML format – hope you’ll like it.

I would also like to mention that you can suggest (in comments) any additional ideas, or that you can even implement it right away, push it to Github and send me a pull request.

Get countries program | @Github repository

Advertisements

World `countries` – database table for MySQL


So today, I was buzzing around and searching for a `countries` table script that I could use in MySQL database. As you can imagine, it wouldn’t make any sense to add all world countries into database table one-by-one.

I’ve found few interesting things around there, but all of those solutions were not flexible and were created for individual projects – and when I say that, I mean that some of those tables have only two columns (like country code and country name), some of those have 3 columns, and some of those have bunch of columns (that are probably not useful to many developers).

Anyway, after checking some of those solutions I came to idea that I could make something on my own – something that will be flexible and customizable. And the result was GetCountries “program” where you can select which columns do you want, click “Get it!” and the program will fetch “fresh” results from Geonames API and will generate you a SQL script. After that you can copy/paste that script and eventually change column names.

Hope someone will find that useful.

GetCountries program | code @Github

%d bloggers like this: