What is the difference in int (11) and int (11) DO NOT KNOW?

What is the difference between int(11) and int(11) UNSIGNED ?

+47
mysql
Mar 08 2018-11-11T00:
source share
7 answers

The UNSIGNED type cannot be negative, but, on the other hand, it has twice as much range for positive integers. The TINYINT, SMALLINT, MEDIUMINT, INT, and BIGINT types have signed and unsigned versions.

For INT, ranges are defined as follows:

 Type Storage Min Max INT 4 -2147483648 2147483647 INT UNSIGNED 4 0 4294967295 

Signed and unsigned types occupy the same storage space (4 bytes for INT).

See more details.

+85
Mar 08 2018-11-11T00:
source share

INT goes from -2147483648 to +2147483647
UNSIGNED INT goes from 0 to 4294967295

11 between braces does not affect the number, as shown in the figure.

+27
Mar 08 2018-11-11T00:
source share

UNSIGNED means that it can only contain non-negative values, i.e. it cannot contain, for example, -20

+6
Mar 08 '11 at 20:40
source share

UNSIGNED is exactly what all its positive (non-signed) numbers are. The size of the bytes is the same, but if your data is never negative, you can get large positive numbers from it. By default, 11 indicates how many characters it will display and display. To get the exact size, search for the used DBMS and type.

+4
Mar 08 2018-11-11T00:
source share

All integer types can have an optional (non-standard) UNSIGNED attribute. An unsigned type can be used to resolve only non-negative numbers in a column, or when a larger upper numeric range for a column is required. For example, if an INT column is not possible, the size of the range of columns is the same, but its endpoints shift from -2147483648 and 2147483647 to 0 and 4294967295.

see here: http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html

+3
Mar 08 2018-11-11T00:
source share

Unsigned cannot contain negative numbers.

+2
Mar 08 '11 at 20:40
source share

An unsigned integer can handle values ​​from 0 to 2 ^ (bit size of an integer field). A signed integer can process values ​​from -2 ^ (size of integer field-1) to 2 ^ (size of integer field-1) -1.

+1
Mar 08 2018-11-11T00:
source share



All Articles