You are currently viewing MySQL String Data Types | Explained

MySQL String Data Types | Explained

 MySQL String Data Types

In this article, we will see What are the string data types in MySQL. We know that while defining a column in a table; we must mention the data type of the column. Data type indicates which type of data and range of values a column can hold. Datatyps in MySQL is mainly divided into 3 types. There are string, numeric, and date/time.

String Types:

char[(M)]

It indicates a fixed-length string that is always right-padded with spaces to the specified length. M indicates length i.e. the maximum number of characters a column can hold and the range of M is 0 to 255.

varchar(M)

It indicates a variable-length string. It stores only the character that you insert. M indicates the maximum number of characters a column can hold and the range of M is 0 to 255.

text[(M)]

It indicates a string of characters. The range of M is 0 to 65535

blob[(M)]

It indicates a string of bits. M indicates the maximum number of bits a column can hold and the range of M is 0 to 65535.

mediumtext[(M)]

It indicates a string of characters. M indicates the maximum number of characters a column can hold. The range of M is 0 to 1,67,77,215.

Leave a Reply