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

September 16th, 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

Entry Filed under: Databases

Leave a Comment

You must be logged in to post a comment.

Trackback this post  |  Subscribe to the comments via RSS Feed


Most Recent Posts