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

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)