Question about INT

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Dale
Forum Contributor
Posts: 466
Joined: Fri Jun 21, 2002 5:57 pm
Location: Atherstone, Warks

Question about INT

Post by Dale »

Ok, lets say i'm using one table in my database called hits and it's an INT(11), and everytime someone visits a page it adds a 1 to that entry... how far up can a INT(11) value go?

Also what's BIG_INT ??
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

http://dev.mysql.com/doc/refman/4.1/en/ ... types.html

The 11 is how many characters it can use. Unsigned maximum on an INT type is 10, while unsigned is 11. Why? The negative sign.
Dale
Forum Contributor
Posts: 466
Joined: Fri Jun 21, 2002 5:57 pm
Location: Atherstone, Warks

Post by Dale »

feyd wrote:http://dev.mysql.com/doc/refman/4.1/en/ ... types.html

The 11 is how many characters it can use. Unsigned maximum on an INT type is 10, while unsigned is 11. Why? The negative sign.
Thanks for the link.

Why? Well I'm having a wonderful idea for something, that might take off and just needed to know how far an INT would go upto 'hit' wise. Thank you anyways. :)

"The negative sign" ?? What neg sign?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Signed integers can be negative. Unsigned cannot. If the number you are dealing with cannot be negative, set the column unsigned to effectively double your available number range. UNSIGNED INT(10) has a range of zero to 4,294,967,295. INT(11) has a range of -2,147,483,648 to 2,147,483,647. It's technically the same number of combinations, just one can do negatives.
Post Reply