TINYTEXT

TINYTEXT is a data type in SQL that is used to store small strings of characters. Its maximum length is 255 characters. Unlike VARCHAR or CHAR data types, TINYTEXT has no specified length when declared and can store up to its maximum length if necessary. Text stored in a TINYTEXT column is not case-sensitive.

Example

CREATE TABLE Sample (
ID INT AUTO_INCREMENT,
Description TINYTEXT,
PRIMARY KEY (ID)
);
INSERT INTO Sample (Description)
VALUES ('Tinytext example');

Output

Query OK, 1 row affected (0.00 sec)
Query OK, 1 row affected (0.01 sec)

Explanation

In the example code, a table named Sample is created with two columns: ID and Description. The ID column is an integer type and the primary key of the table. The Description column is of TINYTEXT type, which can contain up to 255 characters. Then, a new record is inserted into the table with the description ‘Tinytext example’. The output shows the result of these SQL commands, confirming the creation of the table and the successful insertion of a new record.

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