当前位置:网站首页>Mysql 查询使用\G,列转行
Mysql 查询使用\G,列转行
2022-04-23 05:35:00 【GroupiesM】
Mysql查询结尾可使用\G
、\g
、;
来指定查询格式,(仅限于命令行模式下,用navicat、dbeaver等连接工具不支持)
- 查询使用
\G
,结果列转行
mysql> select * from emp limit 2\G
*************************** 1. row ***************************
empno: 7369
ename: SMITH
job: CLERK
mgr: 7902
hiredate: 1980-12-17
sal: 800.00
comm: NULL
deptno: 20
*************************** 2. row ***************************
empno: 7499
ename: ALLEN
job: SALESMAN
mgr: 7698
hiredate: 1981-02-20
sal: 1600.00
comm: 300.00
deptno: 30
2 rows in set (0.00 sec)
- 查询使用
\g
与使用;
效果相同
mysql> select * from emp limit 2\g
+-------+-------+----------+------+------------+---------+--------+--------+
| empno | ename | job | mgr | hiredate | sal | comm | deptno |
+-------+-------+----------+------+------------+---------+--------+--------+
| 7369 | SMITH | CLERK | 7902 | 1980-12-17 | 800.00 | NULL | 20 |
| 7499 | ALLEN | SALESMAN | 7698 | 1981-02-20 | 1600.00 | 300.00 | 30 |
+-------+-------+----------+------+------------+---------+--------+--------+
2 rows in set (0.00 sec)
mysql> select * from emp limit 2;
+-------+-------+----------+------+------------+---------+--------+--------+
| empno | ename | job | mgr | hiredate | sal | comm | deptno |
+-------+-------+----------+------+------------+---------+--------+--------+
| 7369 | SMITH | CLERK | 7902 | 1980-12-17 | 800.00 | NULL | 20 |
| 7499 | ALLEN | SALESMAN | 7698 | 1981-02-20 | 1600.00 | 300.00 | 30 |
+-------+-------+----------+------+------------+---------+--------+--------+
2 rows in set (0.00 sec)
mysql>
版权声明
本文为[GroupiesM]所创,转载请带上原文链接,感谢
https://blog.csdn.net/qq_43529621/article/details/124333346
边栏推荐
- 字符识别easyocr
- [triangle Yang Hui triangle printing odd even cycle JS for break cycle]
- Cmake basic tutorial (39) pkgconfig
- Basic knowledge of redis
- Note: unordered_ Understanding and use of map
- Nécessité de précharger les cookies dans le sélénium
- Utf8 to STD: string and STD: string to utf8
- Several examples of pointer transfer, parameter transfer, value transfer, etc
- Use of uniapp native plug-ins
- deep learning object detection
猜你喜欢
STL learning notes 0x0001 (container classification)
Interview Basics
CPT 104_ TTL 09
Double click The jar package cannot run the solution
(十一)vscode代码格式化配置
Generation of straightening body in 3D slicer
Box collapse and margin collapse
Use of qwbengneview and qwebchannel.
Isosceles triangle - the 9th Lanqiao provincial competition - group C
分支与循环语句
随机推荐
数据安全入门产品——数据库审计系统详解
Some pits used by uni
Why can't V-IF and V-for be used together
Phlli in a VM node
Frequently asked interview questions - 1 (non technical)
Add two pointers? (legal or illegal)
Wbpack configuring production development environment
what is wifi6?
Pavlov and hobbies
Data bus realizes the communication between brother components
Sword finger offer II 022 The entry node of the link in the linked list
转置卷积(Transposed Convolution)
Linear sieve method (prime sieve)
Box collapse and margin collapse
STL function library
Interview Basics
Data mining -- understanding data
Redis in node -- ioredis
(11) Vscode code formatting configuration
‘EddiesObservations‘ object has no attribute ‘filled‘