I am dealing with phone system and have to work with multiple service vendors. For one vendor I have a MySQL table country_codes
like this -
--
You can create a table with countries
only, i.e.:
INSERT INTO countries (country_code,country)
SELECT country_code,country FROM country_codes WHERE country_code=0
Then you can easily update your table
UPDATE country_codes cc, countries c
SET cc.country_code = c.country_code
WHERE LOCATE(c.country,cc.country)=1 AND cc.country_code=0
I haven't tested this, but I believe you can get the point.