MySQL field length

xiaoxiao2021-03-06  51

The amount of storage required for column type

Tinyint 1 byte

Smallint 2 bytes

Mediumint 3 bytes

INT 4 bytes

Integer 4 bytes

Bigint 8 bytes

Float (x) 4 If x <= 24 or 8 if 25 <= x <= 53

Float 4 bytes

Double 8 bytes

Double precision 8 bytes

REAL 8 bytes

DECIMAL (M, D) M bytes (D 2, if m

Numeric (M, D) M bytes (D 2, if m

Date and time type

The amount of storage required for column type

Date 3 bytes

Datetime 8 bytes

Timestamp 4 bytes

Time 3 bytes

Year 1 byte

String type

The amount of storage required for column type

Char (m) M bytes, 1 <= m <= 255

VARCHAR (M) L 1 bytes, where l <= m and 1 <= m <= 255

Tinyblob, Tinytext L 1 byte, L <2 ^ 8

BLOB, Text L 2 bytes, here L <2 ^ 16

Mediumblob, MediumText L 3 bytes, here L <2 ^ 24

Longblob, Longtext L 4 bytes, here L <2 ^ 32

Enum ('Value1', 'Value2', ...) 1 or 2 bytes depends on the number of enumerated values ​​(maximum value 65535)

Set ('Value1', 'Value2', ...) 1, 2, 3, 4 or 8 bytes depends on the number of collections (up to 64 members)

转载请注明原文地址:https://www.9cbs.com/read-116704.html

New Post(0)