Mysql basics: mysql column type-string

Source: Internet
Author: User

Mysql basics: mysql column type-string-CHAR, which is a synonym for CHAR (1. · [NATIONAL] VARCHAR (M) [BINARY] variable-length string. M indicates the maximum column length. M ranges from 0 to 65,535. (The maximum actual length of a VARCHAR is determined by the maximum row size and the character set used. The maximum valid length is 65,532 bytes ). Note: MySQL 5.1 complies with standard SQL specifications and does not delete trailing spaces of VARCHAR values. VARCHAR is short for VARYING. The BINARY attribute is short for BINARY checking rules for the character set of a specified column. Sorting and comparison are based on numeric character values. When VARCHAR is saved, it uses a prefix of one or two bytes plus data. If the length declared by the VARCHAR column is greater than 255, the length prefix is two bytes. · BINARY (M) the BINARY type is similar to the CHAR type, but stores BINARY byte strings instead of non-BINARY strings. · VARBINARY (M) VARBINARY is similar to VARCHAR, but stores binary byte strings instead of non-binary strings. · The maximum length of TINYBLOB is 255 (28-1) bytes. · TINYTEXT is a TEXT column with a maximum length of 255 (28-1) characters. · BLOB [(M)] BLOB column with a maximum length of 65,535 (216-1) bytes. The optional length of this type is M. If given, MySQL creates the column as the BLOB type that is the smallest but sufficient to accommodate the M-byte length value. · TEXT [(M)] a text column with a maximum length of 65,535 (216-1) characters. The optional length is M. MySQL creates a column of the TEXT type that is the smallest but sufficient to accommodate M characters. · The maximum length of MEDIUMBLOB is 16,777,215 (224-1) bytes. · MEDIUMTEXT is a TEXT column with a maximum length of 16,777,215 (224-1) characters. · The maximum length of LONGBLOB is 4,294,967,295 or 4 GB (232-1) bytes. The maximum valid (allowed) Length of the LONGBLOB column depends on the maximum package size and available memory configured in the Client/Server protocol. · LONGTEXT is a TEXT column with a maximum length of 4,294,967,295 or 4 GB (232-1) characters. The maximum valid (allowed) Length of the LONGTEXT column depends on the maximum package size and available memory configured in the Client/Server protocol. · ENUM ('value1', 'value2',...) Enumeration type. Only one value string can be selected from the 'value1 ', 'value2',..., NULL or special ''error values. The ENUM column can have a maximum of 65,535 distinct values. The ENUM value is represented by an integer internally. · SET ('value1', 'value2. A String object can have zero or multiple values. Each value must come from a column value of 'value1 ', 'value2',... the SET column can have a maximum of 64 members. The SET value is represented by an integer internally. Differences between char and varchar enumeration types

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.