- 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
How to display the result more readable if the string is long stored in MySQL VARCHAR?
For this, use \G as in the below syntax −
select * from yourTableName\G
Let us first create a table −
mysql> create table DemoTable1482 -> ( -> Title varchar(255) -> ); Query OK, 0 rows affected (0.52 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable1482 values('Deep Dive using Java with Data Structure And Algorithm'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable1482 values('Introduction To MySQL and MongoDB'); Query OK, 1 row affected (0.12 sec)
Display all records from the table using select statement −
mysql> select * from DemoTable1482;
This will produce the following output −
+--------------------------------------------------------+ | Title | +--------------------------------------------------------+ | Deep Dive using Java with Data Structure And Algorithm | | Introduction To MySQL and MongoDB | +--------------------------------------------------------+ 2 rows in set (0.00 sec)
Following is the query to make the output more readable −
mysql> select * from DemoTable1482\G
This will produce the following output −
*************************** 1. row *************************** Title: Deep Dive using Java with Data Structure And Algorithm *************************** 2. row *************************** Title: Introduction To MySQL and MongoDB 2 rows in set (0.00 sec)
Advertisements