MySQL中g和G的作用

mac2022-06-30  24

\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: utf8collation_connection: utf8_general_ci  Database Collation: utf8_general_ci1 row in set (0.00 sec)

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

转载于:https://www.cnblogs.com/malinzhai/p/10716380.html

最新回复(0)