The columns of type string, since MySQL 4.1, can have a CHARACTER SET attribute that indicates the character set used for the column, and an attribute that indicates the COLLATE collation on. Here's an example:
Code:
CREATE TABLE table
(
c1 CHAR (20) CHARACTER SET utf8
c2 CHAR (20) CHARACTER SET latintrial COLLATE latin1_bin
);
In this table we have defined the column c1 with utf8 character set and its default collation, and the column c2 with latin1 character set and its binary collation. The specified length is relative to the number of characters (the number of bytes it can vary in character sets used and the content of the column). We see the types of fields provided:
Code:
[NATIONAL] CHAR (M) [BINARY | ASCII | UNICODE]
[NATIONAL] VARCHAR (M) [BINARY]
BINARY (M)
VARBINARY (M)
TINYBLOB
TINYTEXT
BLOB [(M)]
TEXT [(M)]
MEDIUMBLOB
MEDIUMTEXT
LONGBLOB
LONGTEXT
ENUM ('value1', 'value2',...)
SET ('value1', 'value2',...)
Bookmarks