MEDIUMTEXT
Example
Section titled “Example”CREATE TABLE example_table ( id INT AUTO_INCREMENT, text_column MEDIUMTEXT, PRIMARY KEY (id));
INSERT INTO example_table (text_column)VALUES ('This is a very long text...');Output
Section titled “Output”Query OK, 0 rows affected (0.01 sec)
Query OK, 1 row affected (0.00 sec)Explanation
Section titled “Explanation”In the provided example, initially a table ‘example_table’ is created with two columns, ‘id’ and ‘text_column’. The ‘id’ column is set as the primary key which auto increments with every new row addition. The ‘text_column’ is defined as ‘MEDIUMTEXT’, a type that can store up to 16 million characters.
A record is inserted into ‘example_table’ with a lengthy string “This is a very long text…” in the ‘text_column’. The Output reflects the successful execution of these operations.