MySQL Field Length

Source: Internet
Author: User

MySQL fields have various types and their lengths are different. The following describes the length of various MySQL fields for your reference.

Value Type
Storage required for column types
TINYINT 1 byte
SMALLINT 2 bytes
MEDIUMINT 3 bytes
INT 4 bytes
INTEGER 4 bytes
BIGINT 8 bytes
FLOAT (X) 4 bytes 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 <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 byte

String type
Storage required for column types
CHAR (M) M bytes, 1 <= M <= 255
VARCHAR (M) L + 1 byte, where L <= M and 1 <= M <= 255
TINYBLOB, tinytext l + 1 byte, here 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, depending on the maximum number of enumeration values 65535)
SET ('value1 ', 'value2',...) 1, 2, 3, 4, or 8 bytes, depending on the maximum number of members in the SET)
 

Implementation of MySQL Field Auto-Increment

How MySQL defines foreign keys

Seven considerations for converting MySQL to Oracle

Detailed description of MySQL foreign key settings

Detailed description of the actual configuration of SlowLog in MySQL

Related Article

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.