MySQL中\g和\G的作用

2019/04/16 13:11
阅读数 47

\g的作用和MySQL中的分号”;"是一样;

\G的作用是讲查找到的内容结构旋转90度,变成纵向结构;

下面举例说明,查找数据库中的存在的存储过程状态:

SHOW PROCEDURE STATUS LIKE '%pricing%'\g

具体如下所示:

mysql> SHOW PROCEDURE STATUS LIKE '%pricing%'\g
+-------+----------------+-----------+----------------+---------------------+---------------------+---------------+---------+----------------------+----------------------+--------------------+
| Db    | Name           | Type      | Definer        | Modified            | Created             | Security_type | Comment | character_set_client | collation_connection | Database Collation |
+-------+----------------+-----------+----------------+---------------------+---------------------+---------------+---------+----------------------+----------------------+--------------------+
| my_db | productpricing | PROCEDURE | root@localhost | 2019-03-27 14:03:00 | 2019-03-27 14:03:00 | DEFINER       |         | utf8                 | utf8_general_ci      | utf8_general_ci    |
+-------+----------------+-----------+----------------+---------------------+---------------------+---------------+---------+----------------------+----------------------+--------------------+
1 row in set (0.00 sec)

把\g替换成\G后,如下所示:

mysql> show PROCEDURE STATUS LIKE '%pricing%'\G
*************************** 1. row ***************************
                  Db: my_db
                Name: productpricing
                Type: PROCEDURE
             Definer: root@localhost
            Modified: 2019-03-27 14:03:00
             Created: 2019-03-27 14:03:00
       Security_type: DEFINER
             Comment:
character_set_client: utf8
collation_connection: utf8_general_ci
  Database Collation: utf8_general_ci
1 row in set (0.00 sec)

这样就一目了然的知道了有一个名称为productpricing的存储过程。

展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部