String Types

The string column types can be used to store text or binary data.

CHAR and VARCHAR are for small amounts of storage (up to 255 characters). They can be declared with the optional BINARY attribute, which means that their values are treated as binary strings, and any comparison or sorting is then performed in a case-sensitive way.

The four BLOB (binary large object) types are for larger amounts of storage of binary data (which can include textual data, handled with case sensitivity). The four TEXT types are for larger amounts of textual storage, therefore, where data is not to be treated as binary data, so operations are not case sensitive.

The capacity and number of bytes required for storage are shown in the following sections, where ...

Get Sams Teach Yourself MySQL in 21 Days, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.