当前位置:网站首页>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
边栏推荐
- refused connection
- Use of uniapp native plug-ins
- Call the interface to get the time
- solidity合约DOS攻击
- Jiugong magic square - the 8th Lanqiao provincial competition - group C (DFS and comparison of all magic square types)
- Common interview questions - 4 (MySQL)
- Reading notes of modern methods of C language programming
- qt. qpa. plugin: Could not find the Qt platform plugin “xcb“ in ““
- Generation of straightening body in 3D slicer
- Xiuxian real world and game world
猜你喜欢
QT drawpixmap and DrawImage blur problem
Requirements for SQL server to retrieve SQL and user information
Create cells through JS (while loop)
After adding qmenu to qtoolbutton and QPushButton, remove the triangle icon in the lower right corner
Jiugong magic square - the 8th Lanqiao provincial competition - group C (DFS and comparison of all magic square types)
How to set the initial value of El input number to null
Three methods of list rendering
Create a tabbar component under the components folder, which is public
弘玑微课堂 | Cyclone RPA之“灵活的数字员工”执行器
Generation of straightening body in 3D slicer
随机推荐
Frequently asked interview questions - 2 (computer network)
QT displays the specified position and size of the picture
[the background color changes after clicking a line]
what is wifi6?
[untitled] Notepad content writing area
Log introduction and building web application
Phlli in a VM node
字符识别easyocr
Deep learning object detection
分支与循环语句
‘EddiesObservations‘ object has no attribute ‘filled‘
MySQL series - install MySQL 5.6.27 on Linux and solve common problems
Simple and basic use of switch and if
[machine learning] scikit learn introduction
STL learning notes 0x0001 (container classification)
catkin_ What did package do
QSslSocket::connectToHostEncrypted: TLS initialization failed
The main difference between pointer and reference
提升独立站转化率攻略 | 挽回弃购用户
Several examples of pointer transfer, parameter transfer, value transfer, etc