- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Find size of text stored in a specific MySQL column?
You can use length() from MySQL to find the size of text stores in a specific column. Let us first create a table
mysql> create table DemoTable ( CustomerName longtext ); Query OK, 0 rows affected (0.67 sec)
Insert records in the table using insert command −
mysql> insert into DemoTable values('Robert'); Query OK, 1 row affected (0.14 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable;
This will produce the following output−
+--------------+ | CustomerName | +--------------+ | Robert | +--------------+ 1 row in set (0.00 sec)
Here is the query to find the size of text stored in a specific column −
mysql> select length(CustomerName) from DemoTable;
This will produce the following output displaying the size of text −
+----------------------+ | length(CustomerName) | +----------------------+ | 6 | +----------------------+ 1 row in set (0.01 sec)
Advertisements