Here is a MySQL table containing continent names, country names and their ISO-3166 codes.
Needed one a while ago, but the ones I found were either kind of lacking or kind of old. So I made one myself by converting a datafile on Wikipedia into the format I wanted. Used some regular expressions and manual corrections. Later I also went through newsletters with Updates on ISO 3166. Hopefully I got it all right, and hopefully it can save you and others some time as well.
I have also subscribed to their updates and try to follow up when they change anything.
If you find any mistakes or updates I’ve missed, please let me know 🙂
Created a project on GitHub for some change tracking. The latest version of the SQL script is found at github.com/Svish/iso-3166-country-codes/blob/master/countries.sql. ðŸ™‚