
- 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
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)
- Related Articles
- How to sum varchar column and display the count in MySQL?
- How can I convert the epoch stored in MySQL table into readable dates?
- Display substring in MySQL if the string is less than a specific length or display a custom message if it is more?
- Get the minimum and maximum value from a VARCHAR column and display the result in separate MySQL columns?
- How to display highest value from a string with numbers set as varchar in MySQL?
- Searching BETWEEN dates stored as varchar in MySQL?
- How to display human readable date in HTML?
- Convert string (varchar) to double in MySQL
- Convert string (varchar) to timestamp format in MySQL?
- MySQL Stored Procedure calling with INT and VARCHAR values
- How can I display MySQL query result vertically?
- How to get the longest VarChar length in MySQL?
- How to remove a character (‘’) in string array and display result in one string php?
- Display records from MySQL stored Procedure with IF…THEN…END IF statements
- How to set a string with hyphen and numbers in MySQL varchar?

Advertisements