Re: Help about a data type

From: Philip Lijnzaad <lijnzaad_at_ebi.ac.uk>
Date: 17 Nov 2000 09:43:41 +0000
Message-ID: <u7wve353xu.fsf_at_o2-3.ebi.ac.uk>


> Hi:
> What data type is better for a field that will contain a number from a
> arithmetic operetion never will be made (like product code, telephone
> number, etc) ?
 

> Is it better numeric, alphanumeric or is it the same ?

it shouldn't matter that much. The advantage of a numeric type is that you get the 'syntax-checking' for free; the disadvantage is that it migt be prove too restrictive. I.e., having a '-' or '()' in a phone number could be useful, and product codes might actually change and starting including letters as well as digitis.

On the whole, I prolly would go for an alpha-numeric type, with explicit syntax checking when entering. Another advantage of this that you can more easily do wildcard searching (if you database supports it).

If speed is a concern, you may want to test which types perform faster on your system; often there is a difference between the two (with numerics typically being faster).

                                                                      Philip
-- 
Time passed, which, basically, is its job. -- Terry Pratchett (in: Equal Rites)
-----------------------------------------------------------------------------
Philip Lijnzaad, lijnzaad_at_ebi.ac.uk \ European Bioinformatics Institute,rm A2-24
+44 (0)1223 49 4639                 / Wellcome Trust Genome Campus, Hinxton
+44 (0)1223 49 4468 (fax)           \ Cambridgeshire CB10 1SD,  GREAT BRITAIN
PGP fingerprint: E1 03 BF 80 94 61 B6 FC  50 3D 1F 64 40 75 FB 53
Received on Fri Nov 17 2000 - 10:43:41 CET

Original text of this message