bit 二进制位 1/0

Byte 字节

  • 1 Byte = 8 bit
  • 1 拉丁字符 = 1 Byte
  • 1 汉字字符 = 2 Bytes (Unicode)

KB (Kilobyte) 千字节

  • 1 KB = 1024 Bytes

MB (Megabyte) 兆字节

  • 1 MB = 1024 KB

GB (Gigabyte) 吉字节

  • 1 GB = 1024 MB

TB (Terabyte)

  • 1 TB = 1024 GB
  • 1 Human Brain = 10 TB

PB (Petabyte)

  • 1 PB = 1024 TB

EB (Exabyte)

  • 1 EB = 1024 PB

ZB (Zetabyte)

  • 1 ZB = 1024 EB

YB (Yotabyte)

  • 1 YB = 1024 ZB

MySQL Integer

Tiny Integer

  • 1 Byte
  • Signed: -27 ~ 27-1 (-128 ~ 127)
  • Unsigned: 0 ~ 28-1 (0 ~ 255)

Small Integer

  • 2 Bytes
  • Signed: -215 ~ 215-1 (-32768 ~ 32767)
  • Unsigned: 0 ~ 216-1 (0 ~ 65535)

Medium Integer

  • 3 Bytes
  • Signed: -223 ~ 224-1 (-8388608 ~ 8388607)
  • Unsigned: 0 ~ 224-1 (0 ~ 16777215)

Integer

  • 4 Bytes
  • Signed: -231 ~ 231-1 (-2147483648 ~ 214748367)
  • Unsigned: 0 ~ 232-1 (0 ~ 4294967295)

Big Integer

  • 8 Bytes
  • Signed: -263 ~ 263-1 (-9223372036854775808 ~ 9223372036854775807)
  • Unsigned: 0 ~ 264-1 (0 ~ 18446744073709551615)

MySQL Text

A 1 ~ 4 bytes length prefix is used to indicates the number of bytes in the value.

Tiny Text

  • 28-1 (255) Bytes
  • 127 个汉字 (Unicode)

Text

  • 216-1 (65535) Bytes
  • 32767 个汉字 (Unicode)

Medium Text

  • 224-1 (16777215) Bytes (About 16 MB)
  • 约 800 万汉字 (Unicode)

Long Text

Reference

bit、byte、位、字节、汉字的关系

int, bigint, smallint, and tinyint (Transact-SQL)

11.2.1 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT

11.1.3 String Type Overview