
借助 MySQL 语句末尾的 \G 或 \g 选项,我们可以在没有分号的情况下运行它。考虑下面的例子 -
mysql> Select * from Stock_item\G
*************************** 1. row ***************************
item_name: Calculator
Value: 15
Quantity: 89
*************************** 2. row ***************************
item_name: Notebooks
Value: 63
Quantity: 40
*************************** 3. row ***************************
item_name: Pencil
Value: 15
Quantity: 40
*************************** 4. row ***************************
item_name: Pens
Value : 65
Quantity: 32
*************************** 5. row ***************************
item_name: Shirts
Value: 13
Quantity: 29
*************************** 6. row ***************************
item_name: Shoes
Value: 15
Quantity: 29
*************************** 7. row ***************************
item_name: Trousers
Value: 15
Quantity: 29
7 rows in set (0.00 sec)上面带有 \G(省略分号)的查询以垂直格式返回结果集。
mysql> Select * from Stock_item\g +------------+-------+----------+ | item_name | Value | Quantity | +------------+-------+----------+ | Calculator | 15 | 89 | | Notebooks | 63 | 40 | | Pencil | 15 | 40 | | Pens | 65 | 32 | | Shirts | 13 | 29 | | Shoes | 15 | 29 | | Trousers | 15 | 29 | +------------+-------+----------+ 7 rows in set (0.00 sec)
上面带有 \g(省略分号)的查询以表格格式返回结果集。
以上就是如何运行没有终止分号的 MySQL 语句?的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号