Maxlength of MySQL TEXT Data Types


Data types and range of data management system MySQL database (Read more)

TEXT Data Types in MySQL

CHAR

CHAR data type for storing a data string of fixed length.

It may contain characters, numbers and special characters.

The fixed length defined in parenthesis, and always reserve space for this length but not in use.

For example, CHAR (50), is a fixed-length field of 50 positions.

The maximum length we can define a CHAR field is 255.

VARCHAR

VARCHAR data type for storing a data string (characters, numbers and special characters) of variable length.

The maximum length is 255 characters before MySQL 5.0.3, and  65,535 in 5.0.3 and later versions. (Reference)

Makes good use of disk space because it does not reserve the space defined maximum length, but it only occupies space the size of the data stored in that field.

It is the most widely used data type for small fields.

TINYTEXT

TINYTEXT data type is used for storing a data string (only characters, no numbers or special characters support) with a maximum length of 255 characters.

TEXT

TEXT data type is used for storing a character string of maximum length of 65,535 characters (~64Kb).

BLOB

The data type BLOB is used for storing BLOB data type (Binary Large Object).

Supports a maximum length of 65,535 bytes of data (~64Kb).

MEDIUMTEXT

MEDIUMTEXT data type is used for storing a string with a maximum length of 16,777,215 characters (~16MB).

MEDIUMBLOB

The data type is used to store data MEDIUMBLOB BLOB with a maximum length 16,777,215 bytes (~16MB).

LONGTEXT

LONGTEXT data type for storing a string of maximum length of 4,294,967,295 characters (~4GB).

LONGBLOB

The data type for storing LONGBLOB a BLOB maximum length of 4,294,967,295 bytes (~4GB).

ENUM

ENUM data type used to enter a list of possible values.

The maximum length is 65,535 possible values.

Attempting to enter a value in this field, that is not listed, do not insert anything and will have an empty value (”).

For example if a column defined as ENUM (‘one’, ‘two’), then in this column can only store the values ‘one’ or ‘two’.

If we add any other value (eg ‘three’), not recorded ‘three’ and instead be the field empty, worthless (”).

SET

The SET datatype is similar to ENUM but the maximum length is 64 possible values, and possible values can be combined.

For example, if a column defined as SET (‘one’, ‘two) then this column will take the following values ‘one’ or ‘two’ or ‘one,two’, ‘two,one.’

~16MB

text datatype mysql

Related Post

, , , ,

No comments yet.

Leave a Reply