[PHP-DB] How to calculate size of INT(x) field

2004-03-05 Thread Richard Davey
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.

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

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



Re: [PHP-DB] How to calculate size of INT(x) field

2004-03-05 Thread Doug Thompson
Richard,

Why do you exclude the MySQL Manual from your list of references?

See sections 6.2 and 6.2.1.  In 6.2.1, you will find:
quote
Another extension is supported by MySQL for optionally specifying 
the display width of an integer value in parentheses following the 
base keyword for the type (for example, INT(4)).
/quote

There is much more about how INT(x) works, but if I copied it all to
here you wouldn't discover the other useful information available.

Doug


On Fri, 5 Mar 2004 11:29:03 +, 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.

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

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