The string data types are CHAR , VARCHAR , BINARY , VARBINARY , BLOB , TEXT , ENUM , and SET . 

For information about storage requirements of the string data types, see Section 11.7, “Data Type Storage Requirements” . 

For descriptions of functions that operate on string values, see Section 12.8, “String Functions and Operators” . 

## 11.3.1 String Data Type Syntax 

The string data types are CHAR , VARCHAR , BINARY , VARBINARY , BLOB , TEXT , ENUM , and SET . 

In some cases, MySQL may change a string column to a type different from that given in a CREATE TABLE or ALTER TABLE  statement. See Section 13.1.20.7, “Silent Column Specification Changes” . 

For definitions of character string columns ( CHAR , VARCHAR , and the TEXT  types), MySQL interprets length specifications in character units. For definitions of binary string columns ( BINARY , VARBINARY , and the BLOB  types), MySQL interprets length specifications in byte units. 

Column definitions for character string data types CHAR , VARCHAR , the TEXT  types, ENUM , SET , and any synonyms) can specify the column character set and collation: 

• CHARACTER SET  specifies the character set. If desired, a collation for the character set can be specified with the COLLATE  attribute, along with any other attributes. For example: 

CREATE TABLE t ( c1 VARCHAR(20) CHARACTER SET utf8, c2 TEXT CHARACTER SET latin1 COLLATE latin1_general_cs ); 

This table definition creates a column named c1  that has a character set of utf8  with the default collation for that character set, and a column named c2  that has a character set of latin1  and a case- sensitive ( _cs ) collation. 

The rules for assigning the character set and collation when either or both of CHARACTER SET  and the COLLATE  attribute are missing are described in Section 10.3.5, “Column Character Set and Collation” . 

CHARSET  is a synonym for CHARACTER SET . 

•Specifying the CHARACTER SET binary  attribute for a character string data type causes the column to be created as the corresponding binary string data type: CHAR  becomes BINARY , VARCHAR  becomes VARBINARY , and TEXT  becomes BLOB . For the ENUM  and SET  data types, this does not occur; they are created as declared. Suppose that you specify a table using this definition: 

CREATE TABLE t ( c1 VARCHAR(10) CHARACTER SET binary, c2 TEXT CHARACTER SET binary, c3 ENUM(’a’,’b’,’c’) CHARACTER SET binary ); 

The resulting table has this definition: 

CREATE TABLE t ( c1 VARBINARY(10), c2 BLOB, c3 ENUM(’a’,’b’,’c’) CHARACTER SET binary 

