Posted almost 10 years ago. Visible to the public.

MySQL shell: Vertical vs horizontal layout

When talking to your MySQL server via a mysql shell, you can terminate queries by ; or \G -- the latter gives you a vertical output.

You know this:

mysql> SELECT * FROM users; +----+---------+---------------------+-----------------+ | id | name | email | greeting | +----+---------+---------------------+-----------------+ | 1 | Alice | | Hello world! | | 2 | Bob | | Hello universe! | | 3 | Charlie | | Hi mom! | +----+---------+---------------------+-----------------+ 3 rows in set (0.00 sec)

This is how it looks like vertically:

mysql> SELECT * FROM users \G *************************** 1. row *************************** id: 1 name: Alice email: greeting: Hello world! *************************** 2. row *************************** id: 2 name: Bob email: greeting: Hello universe! *************************** 3. row *************************** id: 3 name: Charlie email: greeting: Hi mom! 3 rows in set (0.00 sec)

Sometimes, using the vertical output makes more sense. It is helpful for results with lots of columns or when you have one column with lots of content that breaks the "table" layout on your terminal.

Fun fact: Don't confuse \G with \g which is the same as using a semicolon.

Flaky tests are tests that sometimes fail for no obvious reason. They are the plague of many end-to-end (E2E) test suites that automate the browser through tools like Capybara and Selenium.

Join our free training event and learn to fix any flaky test suite, even in large legacy applications.

Owner of this card:

Arne Hartherz
Last edit:
almost 10 years ago
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Arne Hartherz to makandra dev
This website uses short-lived cookies to improve usability.
Accept or learn more