Basic Mysql Data Type

Source: Internet
Author: User
Type Size Description
Char [length] Length bytes Fixed Length field, with a length of 0 to bytes
Varchar [length] String Length + 1 byte Variable Length field. Before MySQL 65535, the length is 0-bytes. After MySQL, the maximum length is bytes. A UTF-8 character occupies three bytes and a GBK character occupies two bytes.
Tinytext String Length + 1 byte String of 0 to bytes
Text String Length + 2 bytes String. The maximum length is 0-bytes.
Mediumtext String Length + 3 bytes String. The length of a group of bytes is 16777215 bytes.
Longtext String Length + 4 bytes String. The maximum length is 4194967295 bytes.
Tinyint [length] 1 byte Range:-128 ~ 127 or 0 ~ 255
Smallint [length] 2 bytes
Mediumint [length] 3 bytes  
Int [length] 4 bytes  
Bigint [length] 8 bytes  
Float 4 bytes  
Double [length, decimals] 8 bytes Run a fixed decimal point
Decimal [length, decimals] Length + 1 byte or length + 2 byte  
Date 3 bytes YYYY-MM-DD format
Datetime 8 bytes YYYY-MM-DD in HH: mm: SS format
Timestamp 4 bytes Yyyymmddhhmmss format
Time 3 bytes Hh: mm: SS format
Enum 1 or 2 bytes Enumeration type
Set 1, 2, 3, 4, or 8 bytes Like Enum, each column can have multiple possible values.
blob is a variant of text. Binary files can be stored and used to encrypt data.

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.