- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
What is TEXT data type in MySQL?
TEXT data objects are useful for storing long-form text strings in a MySQL database. Followings are some point about TEXT data type −
- TEXT is the family of column type intended as high-capacity character storage.
- The actual TEXT column type is of four types-TINYTEXT, TEXT, MEDIUMTEXT and LONGTEXT.
- The four TEXT types are very similar to each other; the only difference is the maximum amount of data each can store.
- The smallest TEXT type, TINYTEXT shares the same character length as VARCHAR.
- TEXT values are treated as character strings.
- TEXT has character set other than binary character set and collation.
- The comparisons and sorting are based on the collation of its character set.
- Truncation of excess trailing spaces from values to be inserted into TEXT columns always generates a warning, regardless of the SQL mode.
- A TEXT family column is just like a VARCHAR.
- TEXT column cannot have DEFAULT value.
Following example shows how to declare a column as TEXT.
mysql> Create table magzine(id INT, title Varchar(25), Introduction TEXT); Query OK, 0 rows affected (0.16 sec) mysql> Describe magzine; +--------------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------+-------------+------+-----+---------+-------+ | id | int(11) | YES | | NULL | | | title | varchar(25) | YES | | NULL | | | Introduction | text | YES | | NULL | | +--------------+-------------+------+-----+---------+-------+ 3 rows in set (0.11 sec)
- Related Articles
- What is BLOB data type in MySQL?
- What is the data type for unix_timestamp in MySQL?
- What is MySQL ENUM data type? What are the advantages to use ENUM data type?
- What should one use CHAR data type or VARCHAR data type in MySQL?
- What is the best data type to store money values in MySQL?
- What is the difference between MySQL DATETIME and TIMESTAMP data type?
- Concatenate a string in an already created field values set with MySQL TEXT data type
- What is Text Data Mining?
- What data type to use for hashed password field in MySQL?
- Which MySQL data type is used for long decimal?
- What is the maximum length of data we can put in a TEXT column in MySQL?
- What is a sequence data type in Python?
- What is data type of FILE in C?
- What is enumerated data type in C language?
- what are the different attributes of MySQL ENUM data type?