Welcome to my blog!

Here I try to keep useful information about IT, mostly related to Web development and Linux stuff. Any comments or feedback that you might have will be much appreciated!

Thanks,
Tomi

Showing MySQL and PostgreSQL’s results on expanded or vertical display

Filed Under (Databases) by admin on 16-09-2006

I do a lot of development with PHP, and often I need to work directly with PostgreSQL and MySQL’s client consoles, for schema work or data manipulation.

On both database clients, you can see a result set on expanded or vertical display (the output formatted in rows instead of the usual columns) with the following methods:

PostgreSQL
Toggle expanded display entering \x directly on the client’s console (pgsql).

MySQL
Use \\G instead of ; to finish the query. Example:
Regular (column) output: SELECT * FROM contact_list ;
Expanded (row) output: SELECT * FROM contact_list \\G

Leave a Reply

You must be logged in to post a comment.