Re: How to calculate size of INT(x) field

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Richard Davey wrote:

Hi all,

Sorry for such a newbie question! But I have been digging through the
O'Reilly MySQL book + MySQL Cookbook and cannot find an answer to what
I think is a very simple question:

When creating an unsigned INT field, how does the value in brackets
(if given) limit the size of the field? I.e. what is the difference in
possible maximum values held between an INT(10) and an INT(4)? I know
MySQL will create an INT(10) as standard but I'm not sure I need it to
be able to hold a number that high.

IIRC, the highest permitted value of an unsigned int is: 8^(number of bytes)-1

so, INT(4) above is 8^4-1 (approx 65500), and INT(10) is 8^10-1 (quite a bit bigger)

Kae

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux