Show query result in more rows

mysql Every time we execute a mysql query in a table with mor fields or a query with few join, we have the problem to show the result because it appears in one single line and it is difficult to read the data quickly.

Searching in google I have found the solution to show the query result as each field per row. The syntax is very simple, you must add \G at the end of the query like this:

select * from students where country=’Italy’\G;

and the result will be something like to:

*************************** 1. row ***************************
id: 1
name: giak
surname: camp
city: Ancona
state: AN
country: Italy
modifiedtime: 2015-19-11 11:52:32
modifiedby: 1
*************************** 2. row ***************************
id: 2
name: micky
surname: mouse
city: Pesaro
state: PU
country: Italy
modifiedtime: 2015-12-11 08:11:45
modifiedby: 1
*************************** 3. row ***************************
…..

 

 

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s