Displaying MySQL query results vertically

Ever found the MySQL table view annoying? The table format is terrible at displaying rows with long values, isn’t it? You can get MySQL to display results vertically:

Some query results are much more readable when displayed vertically, instead of in the usual horizontal table format. Queries can be displayed vertically by terminating the query with \G instead of a semicolon.

More information on this tips page.

mysql> select * from wp_usermeta where user_id in ( select ID from wp_users where user_login = 'ab04d41a-f5b3-4859-9474-5a7047c7e23c' )\G
*************************** 1. row ***************************
  umeta_id: 325
   user_id: 24
  meta_key: nickname
meta_value: Mr G Teacher
*************************** 2. row ***************************
  umeta_id: 326
   user_id: 24
  meta_key: rich_editing
meta_value: true
*************************** 3. row ***************************
  umeta_id: 327
   user_id: 24
  meta_key: comment_shortcuts
meta_value: false
*************************** 4. row ***************************

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.