Database staff handy series: Mysql field length _ MySQL

Source: Internet
Author: User
Storage required for column type TINYINT1 byte SMALLINT2 MEDIUMINT3 byte INT4 byte INTEGER4 byte BIGINT8 byte FLOAT (X) 4 If XFLOAT4 byte DOUBLE8 byte DOUBLEPRECISION8 byte REAL8 byte DECIMAL (M, D) M byte (D + 2, if MNUMERIC (M, D column type requires storage capacity
  
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 <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 number of enumerated values (maximum 65535)
  
SET ('value1 ', 'value2',...) 1, 2, 3, 4, or 8 bytes, depending on the number of SET members (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.