LoginSignup
13
10

More than 3 years have passed since last update.

MySQLのselectの表示結果を\Gで縦に見やすく表示したい

Last updated at Posted at 2018-04-13

SQLの表示結果を縦にしたい\G

mysql> select * from table_name where id = 1\G

普段は;(セミコロン)を終わりにつけているものを\Gに置き換える。

表示例

mysql> select * from test_table;
+----+--------+--------+--------+
| id | teamid | status |   a    |
+----+--------+--------+--------+
|  1 |      1 |   no   |  200   |
|  2 |      1 |   ok   |  250   |
+----+--------+--------+--------+
2 rows in set (0.00 sec)

mysql>
mysql> select * from test_table \G
************ 1. row ************
  id: 1
  teamid: 1
  status: no
  a: 200

************ 2. row ************
  id: 2
  teamid: 1
  status: ok
  a: 250
13
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
13
10