String Column Types
MySQL has a range of string column types. Although in name they are intended for storing string or textual data, you can in fact use them to store any kind of data you want, including numbers, images, sounds, and binary data.
Your choice of string column type for a given application largely depends on the length of data you want to store and how you want to work with the data. Table 5.3 shows MySQL's string column types.
Type Name | Maximum Size |
---|---|
CHAR(M) | M bytes |
VARCHAR(M) | M bytes |
TINYBLOB | 28-1 bytes |
BLOB | 216-1 bytes |
MEDIUMBLOB | 224-1 bytes |
LONGBLOB | 232-1 bytes |
TINYTEXT | 28-1 bytes |
TEXT | 216-1 bytes |
MEDIUMTEXT | 224-1 bytes |
LONGTEXT | 232-1 bytes |
ENUM('value1','value2',...) | 65565 values |
SET('value1','value2',...) | 64 values |
In essence, ...
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.