PDF (US Ltr) - 2.2Mb
PDF (A4) - 2.3Mb
在 MySQL Shell 處於互動模式時,預設會使用表格格式列印結果集。查詢結果會以格式化的表格呈現,以獲得更好的檢視效果並協助分析。
若要在批次模式下執行時取得此輸出格式,請使用 --result-format=table
命令列選項 (或其別名 --table
) 啟動 MySQL Shell,或將 MySQL Shell 組態選項 resultFormat
設定為 table
。
範例 5.1 表格格式的輸出
MySQL localhost:33060+ ssl world_x JS > shell.options.set('resultFormat','table')
MySQL localhost:33060+ ssl world_x JS > session.sql("select * from city where countrycode='AUT'")
+------+------------+-------------+---------------+-------------------------+
| ID | Name | CountryCode | District | Info |
+------+------------+-------------+---------------+-------------------------+
| 1523 | Wien | AUT | Wien | {"Population": 1608144} |
| 1524 | Graz | AUT | Steiermark | {"Population": 240967} |
| 1525 | Linz | AUT | North Austria | {"Population": 188022} |
| 1526 | Salzburg | AUT | Salzburg | {"Population": 144247} |
| 1527 | Innsbruck | AUT | Tiroli | {"Population": 111752} |
| 1528 | Klagenfurt | AUT | Kärnten | {"Population": 91141} |
+------+------------+-------------+---------------+-------------------------+
6 rows in set (0.0030 sec)