Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My main concern is, will one country ever adopt a numeric code that has been used for another in the past, such as can happen with alphanumeric 3166-1 codes? If not, then it seems like a perfect identifier for a primary key in a database...

share|improve this question

Coming from a pure database perspective. No you should not. For the following reasons:

  1. According to this: some codes have been changed. While this will create a mess in all systems this mess will be compounded by the fact that primary keys tend to be harder to change than normal columns.
  2. Security reasons: see this:
  3. Have something such as a primary key under the control of any other organization can lead to trouble.
  4. Strings as primary keys are less "efficient" than numeric keys. I am basing that solely on the fact that a string or character representation needs to be unboxed when used in code and am not talking database implementation. It is also a string since some country codes are prefixed with a zero
share|improve this answer
I think you misread the question a little. I wish to use ISO 3166-1 numeric codes for the primary key, not the 3-character-long codes which can change. Having said that, point 3 is valid for me. – CrazyTim Dec 20 '12 at 3:51
Regarding point 3, I guess it is inherently insecure, and wouldn't be good to do in practice. But on the other hand it is convenient, and a good reference system to use, to sync the table should the codes change, which is why I thought to do it. – CrazyTim Dec 20 '12 at 3:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.