Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the maximum size of int(10) in Mysql

Tags:

mysql

asp.net

In my database I have declared a variable of datatype Int(10). If I type a number in a textbox in my web page, that number is stored in a variable whose largest value can be Int(10) in Mysql. If I type a very large number in the textbox it is giving IndexOutofRangeException.

So I am planning to use the maximumlength property of text box. What is the maximum number that can be stored in a variable of type Int(10) in mysql?

like image 402
Manoj Nayak Avatar asked Jun 04 '12 09:06

Manoj Nayak


People also ask

What is means by INT 11 in MySQL?

In MySQL integer int(11) has size is 4 bytes which equals 32 bit. Signed value is : - 2^(32-1) to 0 to 2^(32-1)-1 = -2147483648 to 0 to 2147483647. Unsigned values is : 0 to 2^32-1 = 0 to 4294967295.

How big is an INT 11?

The values int(1), int(6), int(10), and int(11) will have the maximum value in a range that equals 2147483647 (for signed INT) and 4294967295 (for unsigned INT).

How many bytes is an INT in MySQL?

Below the required storage and range for each integer type. An INT will always be 4 bytes no matter what length is specified.


1 Answers

INT(10) means you probably defined it as INT UNSIGNED.

So, you can store numbers from 0 up to 4294967295 (note that the maximum value has 10 digits, so MySQL automatically added the (10) in the column definition which (10) is just a format hint and nothing more. It has no effect on how big number you can store).

You can use BIGINT UNSIGNED if you want to store bigger values. See the MySQL docs: Integer Types (Exact Value)

like image 198
ypercubeᵀᴹ Avatar answered Sep 24 '22 12:09

ypercubeᵀᴹ