List:General Discussion« Previous MessageNext Message »
From:Lucio Chiappetti Date:June 16 2010 8:44am
Subject:Re: int(10) va int(11)
View as plain text  
On Mon, 14 Jun 2010, Michael Dykman wrote:

> 11 characters of display allow for any int of any size, signed or
> unsigned.  When you do not specify a length attribute in a
> declaration, MySQL uses 11 as the default.

As an astrophysicist, I've always considered a flaw the fact that mysql 
(or SQL in general ?) mix up things like the number of bytes taken by a 
quantity, and the number of digits recommended for display.

In our parliance (e.g. the FITS data format used by the International 
Astronomical Union for data exchange) this is mixing up TTYPE (e.g. 8- 16- 
or 32- bit integers, 32- or 64-bit floats) and TDISP (the Fortran-like 
format suggested for display).

In mysql I always use the generic type (int or float or double, rarely 
things like bigint or tinyint) for numeric quantities, without any 
number-of-digit indication.

For floats they are not just used for display, but sometime affect also 
comparison and that's very annoying if you work usually with numbers like 
1.43E-12 !

-- 
------------------------------------------------------------------------
Lucio Chiappetti - INAF/IASF - via Bassini 15 - I-20133 Milano (Italy)
------------------------------------------------------------------------
Citizens entrusted of public functions have the duty to accomplish them
with discipline and honour
                           [Art. 54 Constitution of the Italian Republic]
------------------------------------------------------------------------
For more info : http://www.iasf-milano.inaf.it/~lucio/personal.html
------------------------------------------------------------------------
Thread
int(10) va int(11)Ryan Chan14 Jun
  • Re: int(10) va int(11)Michael Dykman14 Jun
    • Re: int(10) va int(11)Lucio Chiappetti16 Jun
  • RE: int(10) va int(11)Daevid Vincent14 Jun