Yes, char
is the correct data type for this. The general rule of thumb is: always choose the narrowest (most restrictive) data type possible in the context. This means that any invalid (or out of range) data will not be accepted if it gets input by accident, thus your program/database will become less error prone.
To consider it from another angle: when wanting to use an integer value in code, do you create an integer array of size one? Of course not, because although it would do the job, it is quite unnecessary. i.e. Compare:
int[] value = new int[1] { 123 };
value[0] = 456;
to:
int value = 123;
value = 456;
The first is simple absurd, as I'm sure you see. Assuredly, this isn't so obvious in the context of databases (usage is about as simple if you choose a string
data type), but I think the analogy helps explain the logic behind the choice.
In addition, when it comes to manipulating the values in code, you should find that having the field in the more appropiate data type (i.e. char
) makes it slightly more straightforward to use appropiately in code.
In terms of performance, I wouldn't imagine that using string
would give you any significant overhead. Ok, so it takes up marginally more memory, but that's probably not an issue. I do however think that the other reasons I have just proposed explain why you should choose char
.