mysql中\G和\g的作用

\g:等价于“;”

如下实例:

mysql> select * from t3\g
+------+----------+----------+-------+------------+---------------------+
| id   | username | password | money | birthday   | cztime              |
+------+----------+----------+-------+------------+---------------------+
|    1 | 用户1    | 12346    |   500 | 1995-05-20 | 2018-07-30 09:40:30 |
+------+----------+----------+-------+------------+---------------------+
1 rows in set (0.00 sec)

mysql> select * from t3;
+------+----------+----------+-------+------------+---------------------+
| id   | username | password | money | birthday   | cztime              |
+------+----------+----------+-------+------------+---------------------+
|    1 | 用户1    | 12346    |   500 | 1995-05-20 | 2018-07-30 09:40:30 |
+------+----------+----------+-------+------------+---------------------+   
1 rows in set (0.00 sec)

\G:j将查询到的横向表格纵向输出,方便阅读

如下实例: 
mysql> show create table t4; 
+——-+————————————————————————————————————————————————————-+ 
| Table | Create Table | 
+——-+————————————————————————————————————————————————————-+ 
| t4 | CREATE TABLE t4 ( 
id int(11) DEFAULT NULL, 
username varchar(20) DEFAULT NULL, 
money int(11) DEFAULT NULL 
) ENGINE=InnoDB DEFAULT CHARSET=utf8 | 
+——-+————————————————————————————————————————————————————-+ 
1 row in set (0.00 sec)

mysql> show create table t4\G; 
***************** 1. row ***************** 
Table: t4 
Create Table: CREATE TABLE t4 ( 
id int(11) DEFAULT NULL, 
username varchar(20) DEFAULT NULL, 
money int(11) DEFAULT NULL 
) ENGINE=InnoDB DEFAULT CHARSET=utf8 
1 row in set (0.00 sec)

ERROR: 
No query specified

mysql>

猜你喜欢

转载自blog.csdn.net/shixiu_yuan/article/details/82289241
G
今日推荐