String
MySQL Data Type: String
String Type
Char & Varchar
Type | Size | Description |
---|---|---|
Char(size) | 255 characters, 768 bytes | Fixed-length character field. Rows are padded with whitespace to the defined length. |
VARCHAR(size) | 65,535 bytes | Variable-length character |
Text
Type | Size | Description |
---|---|---|
TINYTEXT | 255 bytes | Variable-length and stored off-row |
TEXT | 65,535 bytes | Variable-length and stored off-row |
MEDIUMTEXT | 16,777,215 bytes (16MB) | Variable-length and stored off-row |
LONGTEXT | 4,294,967,295 bytes (4GB) | Variable-length and stored off-row |
ENUM | 2 bytes | The ENUM doesn’t need a size definition but can hold up to 65,535 values. But strong recommend NOT use it. The order of the enum value change will cause chaos |
SET | 1, 2, 3, 4, or 8 bytes, depending on the number of set members | Similar to ENUM , but SET can have up to 64 list items |
Blob
Type | Size | Description |
---|---|---|
Binary(size) | 255 bytes | similar to the CHAR type, but stores binary byte strings |
TINYBLOB | 255 bytes | Binary Objects |
BLOB | 65,535 bytes | Binary Objects |
MEDIUMBLOB | 16,777,215 bytes (16MB) | Binary Objects |
LONGBLOB | 4,294,967,295 bytes (4GB) | Binary Objects |
Blob vs Text
Type | Blob | Text |
---|---|---|
Storage Type | Byte Sting , Binary data |
String , Non-binary String |
Storage Content | Text , Picture , Video , Sounds |
Pure Text |
Character set | No | Yes |
Comparison and Sorting | numeric values of bytes |
collection of character set |
Reference
- What are the differences between the BLOB and TEXT datatypes in MySQL?
- MySQL :: MySQL 8.0 Reference Manual :: 11.3.1 String Data Type Syntax
- database - What are the differences between the BLOB and TEXT datatypes in MySQL? - Stack Overflow
- MySQL :: MySQL 8.0 Reference Manual :: 11.3 String Data Types
- Mysql Data Types and Sizes for String/ Text | JamesCoyle.net Limited
- MySQL Data Type: An Overview of the Data Types in MySQL - DZone Database