MySQL all basic data types

Source: Internet
Author: User

Type Size Describe
Char[length] Length byte Fixed-length field, 0-255 bytes long
Varchar[length] String length + 1 bytes The variable length field, before mysql5.03, has a length of 0-255 bytes, and after 5.0.3, the maximum length is 65535 bytes. A utf8 character occupies 3 bytes, and a gbk character occupies two bytes. 5.0 length is the number of characters, and 5.0 is the number of bytes before length. Why limit 64k is primarily a row size limit, then rows greater than 64k are in row overflow mode http://www.itpub.net/forum.php?mod=viewthread&tid=1600640
Tinytext String length + 1 bytes A string of 0-255 bytes in length
Text String length + 2 bytes string with a maximum length of 0-65535 bytes
Mediumtext String length + 3 bytes String, group whine length is 16,777,215 bytes
Longtext String length + 4 bytes string with a maximum length of 4,194,967,295 bytes
Tinyint[length] 1 bytes Length is the display of lengths, when complement is played; Range: -128~127 or 0~255
Smallint[length] 2 bytes Length is the display of lengths, when the complement is played; see http://blog.csdn.net/libo222/article/details/51508379
Mediumint[length] 3 bytes Length is the display of lengths, when the complement plays a role;
Int[length] 4 bytes Length is the display of lengths, when the complement plays a role;
Bigint[length] 8 bytes Length is the display of lengths, when the complement plays a role;
Float 4 bytes Length is the display of lengths, when the complement plays a role;
Double[length,decimals] 8 bytes Length is the display of lengths, when the completion of the function; run a fixed decimal point
Decimal[length,decimals] length+1 bytes or length+2 bytes Length is the display of lengths, when the complement plays a role;
Date 3 bytes Use YYYY-MM-DD format
Datetime 8 bytes Using YYYY-MM-DD HH:mm:SS format
Timestamp 4 bytes Use YYYYMMDDHHMMSS format
Time 3 bytes Use HH:MM:SS format
Enum 1 or 2 bytes Enum type
Set 1, 2, 3, 4, or 8 bytes As with enum, except that each column can have multiple possible values
Blob is a variant of text. Allows the storage of binary files and can also be used for some encrypted data.

MySQL all basic data types

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.