MySQL field length

Source: Internet
Author: User

Storage required for column types

TINYINT 1 bytes

SMALLINT 2 bytes

Mediumint 3 bytes

INT 4 bytes

INTEGER 4 bytes

BIGINT 8 bytes

FLOAT (x) 4 if X < = 24 or 8 If < = x < = 53

FLOAT 4 bytes

DOUBLE 8 bytes

DOUBLE PRECISION 8 bytes

Real 8 bytes

DECIMAL (m,d) m bytes (d+2, if M < D)

NUMERIC (m,d) m bytes (d+2, if M < D)

Date and Time type

Storage required for column types

DATE 3 bytes

DATETIME 8 bytes

TIMESTAMP 4 bytes

Time 3 bytes

Year 1 bytes

String type

Storage required for column types

CHAR (m) m-byte, 1 <= m <= 255

VARCHAR (m) l+1 bytes, at this L <= m and 1 <= m <= 255

Tinyblob, Tinytext l+1 Byte, at this l< 2 ^ 8

BLOB, TEXT l+2 Byte, in this l< 2 ^ 16

Mediumblob, Mediumtext l+3 Byte, at this l< 2 ^ 24

Longblob, Longtext l+4 Byte, at this l< 2 ^ 32

Enum ("Value1", "value2",...) 1 or 2 bytes, depending on the number of enumerated values (maximum 65535)

SET ("value1", "value2",...) 1,2,3,4 or 8 bytes,

Depends on the number of members of the collection (up to 64 members)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.