LONGTEXT

LONGTEXT is a type of data type in SQL, specifically in MySQL. It is used to store large amounts of string data. The maximum length of LONGTEXT data type is 4,294,967,295 characters or 4GB. This data type is ideal for storing lengthy text-based data, such as articles or user comments.

Example

CREATE TABLE Sample(
ID INT,
Notes LONGTEXT
);
INSERT INTO Sample(ID, Notes)
VALUES(1, 'This is an example of LONGTEXT in MySQL');

Output

Query OK, 0 rows affected (0.22 sec)
Query OK, 1 row affected (0.01 sec)

Explanation

This example creates a new table ‘Sample’ with a column ‘Notes’ that has a data type of LONGTEXT. One row is then inserted into ‘Sample’, including a LONGTEXT value. The LONGTEXT data type in MySQL can contain a maximum of 4,294,967,295 characters, making it ideal for storing large amounts of text.

For in-depth explanations and examples SQL keywords where you write your SQL, install our extension.