Best data type for storing large strings in MySQL?

MySQLMySQLi Database

You can use text data type to store large strings. Following is the syntax −

CREATE TABLE yourTableName
(
   yourColumnName text,
   .
   .
   N
);

Let us first create a table −

mysql> create table DemoTable
   -> (
   -> MyStringValue text
   -> );
Query OK, 0 rows affected (0.67 sec)

Insert some records in the table using insert command −

mysql> insert into DemoTable values('This is a text data type to store large string'); Query OK, 1 row affected (0.17 sec)

Display all records from the table using select statement −

mysql> select *from DemoTable;

This will produce the following output −

+------------------------------------------------+
| MyStringValue                                  |
+------------------------------------------------+
| This is a text data type to store large string |
+------------------------------------------------+
1 row in set (0.00 sec)
raja
Published on 10-Jul-2019 09:11:35
Advertisements