July 12

Difference Between Integer Types in MySQL and Their Max Values

0  comments

In MySQL, there are 5 different integer types, and each type allows for different integer value sizes. In addition, each type can be signed or unsigned. If your value is always positive, then you can make your integer type unsigned.

The following table shows the values that different integer types (signed/unsigned) can hold:

Integer Type Start Value End Value
TINYINT -128 127
TINYINT (Unsigned) 0 256
SMALLINT -32,768 32,767
SMALLINT (Unsigned) 0 65,535
MEDIUMINT -8,388,608 8,388,607
MEDIUMINT (Unsigned) 0 16,777,215
INT -2,147,483,648 2,147,483,647
INT (Unsigned) 0 4,294,967,295
BIGINT -9,223,372,036,854,775,808 9,223,372,036,854,775,807
BIGINT (Unsigned) 0 18,446,744,073,709,551,615

Tags

addition, BIGINT, difference, end, INT, integer type, integer types, integer value, max values, MEDIUMINT, mysql, start, TINYINT, type, Types, UNSIGNED


You may also like

Leave a Reply

Your email address will not be published. Required fields are marked *

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

Subscribe to our newsletter now!