xefhvq
Last Updated: February 25, 2016
·
1.607K
· x3ro
0266e613fe487607b582252ca8ae78f2

Vertically displaying columns in MySQL query

When using the MySQL command line client, it is usually unwise to write a query like

SELECT * FROM foo;

because you will end up with a really wide table that gets broken up into multiple lines by your terminal, and it probably be hard to know which values belongs to a column:

Looks familiar? Well then, \G to the rescue!

SELECT * FROM foo \G

This query will instead return a neat, vertical representation of your data (especially useful if you're only looking at a single row):

*************************** 1. row ***************************
 username: Foobar
 disable: 0
 usergroup: 1
 ...

Note that there must not be a semicolon before or after the \G.

Say Thanks
Respond

1 Response
Add your response

5971
Photo on 08.01.2013 at 04.15

nice

over 1 year ago ·