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)