What is the size of column of int(11) in mysql in bytes?

Gaurav picture Gaurav · Apr 12, 2011 · Viewed 444.6k times · Source

What is the size of column of int(11) in mysql in bytes?

And Maximum value that can be stored in this columns?

Answer

Matt MacLean picture Matt MacLean · Apr 12, 2011

An INT will always be 4 bytes no matter what length is specified.

  • TINYINT = 1 byte (8 bit)
  • SMALLINT = 2 bytes (16 bit)
  • MEDIUMINT = 3 bytes (24 bit)
  • INT = 4 bytes (32 bit)
  • BIGINT = 8 bytes (64 bit).

The length just specifies how many characters to pad when selecting data with the mysql command line client. 12345 stored as int(3) will still show as 12345, but if it was stored as int(10) it would still display as 12345, but you would have the option to pad the first five digits. For example, if you added ZEROFILL it would display as 0000012345.

... and the maximum value will be 2147483647 (Signed) or 4294967295 (Unsigned)