mysql 按列显示_为什么mysql中用\G表示按列方式显示

关于mysql的错误 - no query specified

学习了:http://blog.csdn.net/tenfyguo/article/details/7566941

sql语句可以用分号或者\G来结尾;出现这个错误一般是分号多写了;

学习了:http://blog.csdn.net/guoqianqian5812/article/details/51754594

分号也可以换成 \g

在Navicat中是不支持\G和\g标记的;

学习了:https://stackoverflow.com/questions/2277014/why-the-g-in-select-from-table-name-g  这个说的最明白了,膜拜一下org!

\G表示 go的意思;

In summary...

--vertical >> -E >> ego >> \G ...Tada !

学习了:https://www.2cto.com/database/201212/178075.html 老外说的还针对,

使用-E的话,的确以列方式显示;但是-E登录之后没有办法按行显示了;

-E登录的方法,在开始菜单里面:C:\ProgramData\Microsoft\Windows\Start Menu\Programs\MySQL\MySQL Server 5.7,复制

MySQL 5.7 Command Line Client - Unicode 然后修改其中的属性,添加-E选项,

"C:\Program Files\MySQL\MySQL Server 5.7\bin\mysql.exe" "--defaults-file=C:\ProgramData\MySQL\MySQL Server 5.7\my.ini" "-uroot" "-E" "-p" "--default-character-set=utf8"

mysql登录之后就有\g是结束符的提示:

Enter password: ************

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 69

Server version: 5.7.3-m13 MySQL Community Server (GPL)

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

在mysql界面内直接输入help也可以看见:

mysql> help

For information about MySQL products and services, visit:

http://www.mysql.com/

For developer information, including the MySQL Reference Manual, visit:

http://dev.mysql.com/

To buy MySQL Enterprise support, training, or other products, visit:

https://shop.mysql.com/

List of all MySQL commands:

Note that all text commands must be first on line and end with ';'

? (\?) Synonym for `help'.

clear (\c) Clear the current input statement.

connect (\r) Reconnect to the server. Optional arguments are db and host.

delimiter (\d) Set statement delimiter.

ego (\G) Send command to mysql server, display result vertically.

exit (\q) Exit mysql. Same as quit.

go (\g) Send command to mysql server.

help (\h) Display this help.

notee (\t) Don't write into outfile.

print (\p) Print current command.

prompt (\R) Change your mysql prompt.

quit (\q) Quit mysql.

rehash (\#) Rebuild completion hash.

source (\.) Execute an SQL script file. Takes a file name as an argument.

status (\s) Get status information from the server.

tee (\T) Set outfile [to_outfile]. Append everything into given outfile.

use (\u) Use another database. Takes database name as argument.

charset (\C) Switch to another charset. Might be needed for processing binlog

with multi-byte charsets.

warnings (\W) Show warnings after every statement.

nowarning (\w) Don't show warnings after every statement.

resetconnection(\x) Clean session context.

For server side help, type 'help contents'

mysql>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: 在 MySQL 中,% 符号用作通配符,表示匹配任意字符或字符集合。它通常与 LIKE 运算符一起使用来进行模式匹配。如果您要匹配数字,可以使用以下示例: - 匹配以数字结尾的字符串:`SELECT * FROM table WHERE column LIKE '%[0-9]'` - 匹配以数字开头的字符串:`SELECT * FROM table WHERE column LIKE '[0-9]%'` - 匹配包含数字的字符串:`SELECT * FROM table WHERE column LIKE '%[0-9]%'` 请注意,这些语句假定您要匹配的数字是基于 ASCII 字符集。如果您需要匹配其他字符集中的数字,请相应地调整匹配模式。 ### 回答2: 在MySQL中,可以使用百分号(%)来表示number。百分号是通配符的一种形式,用于模式匹配查询。当我们在查询时,希望找到与给定数字相匹配的数据时,可以使用百分号作为通配符来指定模式。 例如,假设我们有一个名为"numbers"的表,其中包含一个名为"num"的列,存储了一些数字。如果我们想要查询所有以数字1开头的记录,我们可以使用如下的SQL语句: SELECT * FROM numbers WHERE num LIKE '1%'; 在这个查询语句中,'1%'表示以数字1开头的任意数字。百分号通配符表示可以匹配任意数量的字符,包括0个字符。 同样地,我们还可以使用百分号作为通配符来表示其它的数字模式。举个例子,如果我们想要查询所有以数字5结尾的记录,我们可以使用如下的SQL语句: SELECT * FROM numbers WHERE num LIKE '%5'; 在这个查询语句中,'%5'表示以数字5结尾的任意数字。百分号通配符放在数字前面表示任意数量的字符可以匹配。 总而言之,在MySQL中,我们可以使用百分号作为通配符来表示number的模式,可以匹配任意数量的字符。 ### 回答3: 在MySQL中,用百分号(%)表示模糊匹配操作符,可以用来匹配数字字段中的数字部分。当使用LIKE语句进行模糊查询时,可以在模式中使用百分号来代表任意字符或字符的序列。 如果想要查询以特定数字开头的数据,可以使用以下语句: SELECT * FROM 表名 WHERE 字段名 LIKE '数字%' 其中,字段名是要进行查询的数字字段的名称,数字是要匹配的数字。 例如,如果要查询以数字9开头的数据,可以使用以下语句: SELECT * FROM 表名 WHERE 字段名 LIKE '9%' 这将返回所有以数字9开头的数据。 此外,%还可以用在类似于通配符的方式来查询任意数字: - 若要查询以数字9结尾的数据,可以使用以下语句:SELECT * FROM 表名 WHERE 字段名 LIKE '%9' - 若要查询包含数字9的数据,可以使用以下语句:SELECT * FROM 表名 WHERE 字段名 LIKE '%9%' 需要注意的是,当使用LIKE语句进行模糊查询时,使用百分号(%)计算会比较耗时,因为它需要对整个表进行扫描匹配。如果可以使用其他更精确的查询方法,会更加高效。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值