Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What happens if a int column reach the max value?

Tags:

database

mysql

Suppose a huge database. For example I have more than 4294967295(for mysql INT) users. In any column which type is int and auto_increment, what happens if that column reach the max value?

like image 276
miqbal Avatar asked Dec 25 '10 12:12

miqbal


People also ask

What happens when INT exceeds max value?

Overflow in int As int data type is 32 bit in Java, any value that surpasses 32 bits gets rolled over. In numerical terms, it means that after incrementing 1 on Integer. MAX_VALUE (2147483647), the returned value will be -2147483648. In fact you don't need to remember these values and the constants Integer.

What is the max int value in SQL?

The range of an int data type is -2,147,483,648 to 2,147,483,647.

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.


1 Answers

The int will overflow and you will not be able to insert more records to that table.

like image 55
Oded Avatar answered Sep 18 '22 20:09

Oded