lukes / ISO-3166-Countries-with-Regional-Codes

ISO 3166-1 country lists merged with their UN Geoscheme regional codes in ready-to-use JSON, XML, CSV data sets
Other
2.19k stars 3.34k forks source link

Question: Are country codes constant? #24

Closed akarelas closed 6 years ago

akarelas commented 6 years ago

Sorry for asking in the issues, I really don't know where else to look for this information, and I can't find it on the web either.

Are country-code expected to be constant? I know country names and 2-letter codes can change (eg FYROM MK soon) but will the numeric codes in this repo's CSVs remain constant nomatter what? Can I safely use those as primary keys, to refer to countries from other tables? And keep your CSV updated in my app, without fear of inconsistency in my app in the future? (except for when two countries join, and a numeric code then disappears)

Thanks.

lukes commented 6 years ago

The numeric country codes will not change for a country unless its territory is changed. But when they're changed they're withdrawn and never used again. It would be fine to use them as primary keys.

From wikipedia:

https://en.wikipedia.org/wiki/ISO_3166-1_numeric#Withdrawn_codes

When countries merge, split, or undergo territorial change, their numeric codes are withdrawn and new numeric codes are assigned.