Default length of common MySql Fields

Source: Internet
Author: User
Tags mysql index

The following describes the default length of some common MySql fields for your reference. If you are interested in MySql fields, you may wish to take a look. I believe this will help you.

Integer:
TINYINT 1 byte
SMALLINT 2 bytes
MEDIUMINT 3 bytes
INT 4 bytes
INTEGER 4 bytes
BIGINT 8 bytes

Floating point type:
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:
DATE 3 bytes
DATETIME 8 bytes
TIMESTAMP 4 bytes
TIME 3 bytes
YEAR 1 byte

String type:
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)

The following describes the default length of common MySql fields.

MySQL inserts multiple records using INSERT

Range of MySQL numeric data types

MySQL index type

How to modify the order of mysql Fields

How to add or delete a primary key 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.