PDF (US Ltr) - 2.3Mb
PDF (A4) - 2.3Mb
当 MySQL Shell 处于交互模式时,默认情况下使用表格格式打印结果集。 查询结果以格式化表格的形式呈现,以便更好地查看和分析。
要在批量模式下运行时获得此输出格式,请使用 --result-format=table
命令行选项(或其别名 --table
)启动 MySQL Shell,或将 MySQL Shell 配置选项 resultFormat
设置为 table
。
示例 5.1 表格格式输出
Press CTRL+C to copyMySQL 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)