Why are numbers used as ID in databases (think primary key + AI) and pretty much everywhere instead of letters?
There are 10 digits available, while the English alphabet has as much as 26 letters.
Let’s say that each letter/digits takes a spot. 98 takes two spots and 1202 takes four, etc. In four spots, you can store up to 10 000 IDs, but if you use letters instead, you could store as much as 456 976 IDs with the same amount of spots. Even more if you’d use case-sensitivity. That’s almost 50 times more.
I do realize that this most likely doesn’t matter for the regular user, but why aren’t larger databases using letters instead of digits as IDs?
You are confusing characters for numeric values.
An ID column that uses an integer (say a 32bit Integer) as the data type will only take 4 bytes per row. It will also be a native value in memory and can be acted on natively in the CPU (as a binary representation).
This is not the same for characters – even if one assumes ASCII (8bit) is used, the moment you go over 4 characters, you are using more space. You also need to translate between the values in order to make valid comparisons.