MYSQL:使用\G参数改变输出结果集的显示方式
来源:互联网 发布:电视台亏损 知乎 编辑:程序博客网 时间:2024/06/05 08:58
转自:http://blog.csdn.net/warmspace2008/article/details/8334010
在MYSQL命令行中使用\G参数,将输出按列显示。当需要看表中各字段的值时非常有用。
普通的SQL命令输出如下:
- mysql> select * from t_goods;
- +------+------------+----------+------------+-----------------------------------
- -----------------------------+
- | id | goods_name | quantity | add_date | description
- |
- +------+------------+----------+------------+-----------------------------------
- -----------------------------+
- | 1 | MYSQL5 | 50 | 2012-12-12 | A book that has been read but is i
- n good condition. See the seller’s listing for full details and descr iption of
- any imperfections. |
- +------+------------+----------+------------+-----------------------------------
- -----------------------------+
下面是使用\G选项的输出:
- mysql> select * from t_goods \G
- *************************** 1. row ***************************
- id: 1
- goods_name: MYSQL5
- quantity: 50
- add_date: 2012-12-12
- description: A book that has been read but is in good condition. See t
- he seller’s listing for full details and description of any imperfections.
注意:\G为大写字母,不可使用小写;使用\G参数后,SQL语句后可以不加分隔符,如果加分隔符,则会报“error:no query specified”的错误。
这样的显示效果与MYSQL命令的-E参数是一样的。使用-E参数后,结果集默认以列的方式显示:
- C:\Users\qxl>mysql -uroot -E
- Welcome to the MySQL monitor. Commands end with ; or \g.
- Your MySQL connection id is 13
- Server version: 5.1.28-rc-community MySQL Community Server (GPL)
- Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
- mysql> use test;
- Database changed
- mysql> select * from t_goods;
- *************************** 1. row ***************************
- id: 1
- goods_name: MYSQL5
- quantity: 50
- add_date: 2012-12-12
- description: A book that has been read but is in good condition. See t
- he seller’s listing for full details and description of any imperfections.
0 0
- MYSQL:使用\G参数改变输出结果集的显示方式
- Mysql join方式的结果集
- mysql使用in查询,按照期望的顺序输出结果
- TimesTen结果集显示方式
- 需要DLL函数输出的结果信息,尽量使用传入参数做为输出变量~!
- Log4j输出方法参数不同所显示的结果不同参考
- tpcc-mysql使用及输出结果解读
- mysql engine的改变方式
- error:使用rebuild编译链接dll文件和exe文件,结果改变产生dll的源文件的内容,输出结果都没有改变
- 灵活的报表结果输出方式
- 改变python输出流的编码方式
- mybatis 下 mysql in查询按照参数顺序输出结果
- Android开发:如何设置EditText多行显示输出及改变多行EditText的默认显示方式
- 输出结果显示百分比
- mysql的EXPLAIN关键字输出结果解释
- MYsql的UNION使用 构造结果集
- G++ 编译结果优化方式!!!!!
- mysql的两个获取结果方式
- UncaughtExceptionHandler加Process 让应用程序不异常崩溃退出
- trimpath 前端模板引擎
- 【字符哈希】-DLUToj-1250-变为回文字串
- JAVAFX 在TableView里面使用CheckBox
- OPENFIRE支持EMOJI
- MYSQL:使用\G参数改变输出结果集的显示方式
- 数据导入功能实现心得
- REST & ReSTful
- js编码转换
- android http多请求异步封装对你绝对有用
- 完全退出Android程序的几种方法
- shark 0.9.1 整理安装笔记
- NYOJ263精挑细选
- 更新表中的某一列为该表的rownum