Re: Indexing by multiple keys
Arved Sandstrom wrote:
Lew wrote:
Lew wrote:
An SSN is still not numeric, though.
Arved Sandstrom wrote:
It's numeric, consisting of 3 numbers. Even the SSA says so.
Where does it say so?
Without being facetious, all over their website, including at
http://www.socialsecurity.gov/history/ssn/geocard.html.
They use "number" in the loose English sense of "numeric string"; they make no
claim there that the SSN is actually numeric, I term I selected advisedly.
Their use of "odd" and "even" is cognate to describing letters as "capital" or
"lower case". There is a numeric algorithm involved in creating an SSN, but
once assigned it acts as a label, and not as a number.
I could have been more accurate and said that the SSN is non-numeric as
commonly used in situations such as described in this thread.
The group number and serial number definitely use numerical concepts
(like odd and even for group number).
....
It's not a string. It's just that it makes little or no sense to
contemplate arithmetic operations involving SSNs, except perhaps for
incrementing the serial number part.
The only numeric operation that makes sense for an SSN is confirmation of a
check digit, an operation also commonly performed in software on character
strings with letters in them.
If you simply increment the serial number part, you could break the
checksum, so that operation isn't actually valid.
What is the checksum procedure for a SSN? I wasn't aware there was any.
The SSA does not describe any kind of checksum procedure for figuring
out whether an SSN is valid. There is a procedure of course for doing so.
I don't know the procedure in detail, and I don't think the SSA particularly
wants to publicize it lest identity hackers mess with it.
Note that their site, in particular the page you linked, describes three
groups of characters (that they call digits) that are independent of each
other. Note also that leading zeros are significant - you cannot have an SSN
of "12345678" or "012-4-5678". Also, group numbers are assigned in an
arbitrary (but fixed) lexical order, not a numeric order.
As you point out, it makes no sense to do any calculations (other than
checksum) on an SSN. What is the square root of an SSN?
Bear in mind that the English word "number" is used for numeric strings as
well as quantitative entities. My point is that SSNs are the former, not the
latter, not that the word "number" does not apply.
I do agree that it is possible to model an SSN as an int or as a String.
For the OP's purpose in particular, it makes more sense to model an SSN as a
String than an int.
--
Lew