Making Long Output Lines More Readable
Problem
You have a query that produces long output lines that wrap around and look messy on your screen.
Solution
Use vertical output format.
Discussion
Some statements generate output lines that are so long they take up more than one line on your terminal, which can make query results difficult to read. Here is an example that shows what excessively long query output lines might look like on your screen:
mysql>SHOW FULL COLUMNS FROM limbs;
+-------+-------------+-------------------+------+-----+---------+-------+-----
----------------------------+---------+
| Field | Type | Collation | Null | Key | Default | Extra | Priv
ileges | Comment |
+-------+-------------+-------------------+------+-----+---------+-------+-----
----------------------------+---------+
| thing | varchar(20) | latin1_swedish_ci | YES | | NULL | | sele
ct,insert,update,references | |
| legs | int(11) | NULL | YES | | NULL | | sele
ct,insert,update,references | |
| arms | int(11) | NULL | YES | | NULL | | sele
ct,insert,update,references | |
+-------+-------------+-------------------+------+-----+---------+-------+-----
----------------------------+---------+To avoid the problem, generate “vertical” output
with each column value on a separate line. This is done by terminating
a statement with
\G rather than with
a ; character or with \g. Here’s what the result from the
preceding statement looks like when displayed using vertical
format:
mysql>SHOW FULL COLUMNS FROM limbs\G *************************** ...Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access