- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is TEXT data type in MySQL?
152 Lectures 16 hours
87 Lectures 5.5 hours
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)
- What is BLOB data type in MySQL?
- What is MySQL ENUM data type? What are the advantages to use ENUM data type?
- What is the data type for unix_timestamp in MySQL?
- What is Text Data Mining?
- What should one use CHAR data type or VARCHAR data type in MySQL?
- What is the difference between MySQL DATETIME and TIMESTAMP data type?
- What is the best data type to store money values 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?
- Which MySQL data type is used for long decimal?
- Concatenate a string in an already created field values set with MySQL TEXT data type
- what are the different attributes of MySQL ENUM data type?
- What data type to use for hashed password field in MySQL?