MySQL “pretty printing”

I just discovered an apparently wide spread tip for mysql:


mysql> select 1, 2, 3, 4 ;
+---+---+---+---+
| 1 | 2 | 3 | 4 |
+---+---+---+---+
| 1 | 2 | 3 | 4 |
+---+---+---+---+
1 row in set (0.00 sec)


mysql> select 1, 2, 3, 4 \G;
*************************** 1. row ***************************
1: 1
2: 2
3: 3
4: 4
1 row in set (0.00 sec)

As you might have seen, the difference comes from the “\G” !

It’s very usefull when you select lot of columns that doesn’t fit the width of your terminal !
Shame on me I didn’t knew that before !

Advertisements

2 Comments »

  1. fasten said

    on a ‘show slave status’, you’ll quickly know the \G thing 😉

    cheers sam

    • smaftoul said

      On a ‘show table status’ I also was supposed to learn it, but I didn’t until now ! 😉
      Anyway, I’m searching for a way to do something like: “select engine from (show table status)”, you probably can do that with the information_schema db, but I would prefer the syntax I use. Do you know how to do that ?

RSS feed for comments on this post · TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: