Overview
In this tutorial, we will learn about MySQL String Data Types. Strings are an important data type. A String is used for storing character strings. A character string is a sequence of characters.
String data types
String data types provided in MySQL are as follows.
- CHAR
- VARCHAR
- TINYTEXT
- TEXT
- MEDIUMTEXT
- LONGTEXT
String Data Type |
Description |
CHAR | CHAR data type is for fixed-length strings. Fixed-length means that a string is stored using a fixed number of bytes. It is right-padded with spaces to the specified length when stored. |
VARCHAR | VARCHAR data type is for variable-length strings. Variable-length stores the string value and string length together. The amount of storage space that VARCHAR uses depends on the number of characters in the string |
TINYTEXT | TINYTEXT data type is for variable-length strings and allows up to a maximum of 255 characters |
TEXT | The TEXT data type is used for variable-length strings and allows up to a maximum of 65,535 characters |
MEDIUMTEXT | MEDIUMTEXT data type is for variable-length strings and allows up to a maximum of 16,777,215 characters |
LONGTEXT | LONGTEXT data type is for variable-length strings and allows up to a maximum of 4,294,967,295 characters. The maximum permitted length depends on the client/server protocol |
—
MySQL Tutorials
MySQL Tutorials on this website:
https://www.testingdocs.com/mysql-tutorials-for-beginners/
For more information on MySQL Database: