MySQL Shell 8.4  /  ...  /  垂直格式

5.7.3 垂直格式

垂直格式选项以垂直方式打印结果集,而不是水平表格,这与对 SQL 查询使用 \G 查询终止符的方式相同。如果输出中包含较长的文本行,则垂直格式更易于阅读。

要获得此输出格式,请使用 --result-format=vertical 命令行选项(或其别名 --vertical)启动 MySQL Shell,或将 MySQL Shell 配置选项 resultFormat 设置为 vertical

示例 5.3 垂直格式输出

MySQL  localhost:33060+ ssl  world_x  JS > shell.options.set('resultFormat','vertical')
MySQL  localhost:33060+ ssl  world_x  JS > session.sql("select * from city where countrycode='AUT'")
*************************** 1. row ***************************
         ID: 1523
       Name: Wien
CountryCode: AUT
   District: Wien
       Info: {"Population": 1608144}
*************************** 2. row ***************************
         ID: 1524
       Name: Graz
CountryCode: AUT
   District: Steiermark
       Info: {"Population": 240967}
*************************** 3. row ***************************
         ID: 1525
       Name: Linz
CountryCode: AUT
   District: North Austria
       Info: {"Population": 188022}
*************************** 4. row ***************************
         ID: 1526
       Name: Salzburg
CountryCode: AUT
   District: Salzburg
       Info: {"Population": 144247}
*************************** 5. row ***************************
         ID: 1527
       Name: Innsbruck
CountryCode: AUT
   District: Tiroli
       Info: {"Population": 111752}
*************************** 6. row ***************************
         ID: 1528
       Name: Klagenfurt
CountryCode: AUT
   District: Kärnten
       Info: {"Population": 91141}
6 rows in set (0.0027 sec)