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)