当前位置:网站首页>Multi table operation - sub query
Multi table operation - sub query
2022-07-05 11:47:00 【Soup key TJ】
Catalog
The result is a single row, single column
The result is multi row, single column
The result is multi row, multi column
Basic concepts
- The query statement is nested in the query statement , We will call the nested query sub query
Three common situations
- Please click to view the data preparation of the table
The result is a single row, single column
- effect : The result of the query can be used as the query condition of another statement , Use operators to judge
- The query syntax :
- select Name from Table name where Name =(select Name from Table name [where Conditions ]);
- example : Query the oldest user name

-- Query the oldest user name SELECT name,age FROM user WHERE age=(SELECT MAX(age) FROM user);The result is multi row, single column
- effect : As a condition , Use the operator in or not in Judge
- The query syntax :
- select Name from Table name where Name [not] in (select Name from Table name [where Conditions ])
- example : Check the order information of Zhang San and Li Si

-- Check the order information of Zhang San and Li Si SELECT * FROM orderlist WHERE uid IN (SELECT id FROM user WHERE name IN (' Zhang San ',' Li Si '));
The result is multi row, multi column
- effect : The query result can be used as a virtual table to participate in the query
- The query syntax :
- select Name from Table name [ Alias ],(select Name from Table name [where Conditions ]) [ Alias ] [where Conditions ];
- example : Query the order table id Greater than 4 Order information and user information of

-- Query the order table id Greater than 4 Order information and user information of SELECT u.name, o.number FROM user u, (SELECT * FROM orderlist WHERE id>4) o WHERE o.uid=u.id;
边栏推荐
- Proof of the thinking of Hanoi Tower problem
- 石油化工企业安全生产智能化管控系统平台建设思考和建议
- 13. (map data) conversion between Baidu coordinate (bd09), national survey of China coordinate (Mars coordinate, gcj02), and WGS84 coordinate system
- Mongodb replica set
- Manage multiple instagram accounts and share anti Association tips
- 查看多台机器所有进程
- COMSOL -- establishment of 3D graphics
- 1 plug-in to handle advertisements in web pages
- vscode快捷键
- ZCMU--1390: 队列问题(1)
猜你喜欢

【yolov5.yaml解析】

中非 钻石副石怎么镶嵌,才能既安全又好看?

1 plug-in to handle advertisements in web pages

Use and install RkNN toolkit Lite2 on itop-3568 development board NPU
![[upsampling method opencv interpolation]](/img/6b/5e8f3c2844f0cbbbf03022e0efd5f0.png)
[upsampling method opencv interpolation]

高校毕业求职难?“百日千万”网络招聘活动解决你的难题

【上采样方式-OpenCV插值】

How to protect user privacy without password authentication?

yolov5目标检测神经网络——损失函数计算原理

多表操作-子查询
随机推荐
Empêcher le navigateur de reculer
pytorch-softmax回归
Acid transaction theory
Unity Xlua MonoProxy Mono代理类
[mainstream nivida graphics card deep learning / reinforcement learning /ai computing power summary]
Dynamic SQL of ibatis
Go language learning notes - first acquaintance with go language
石油化工企业安全生产智能化管控系统平台建设思考和建议
Solve readobjectstart: expect {or N, but found n, error found in 1 byte of
Redis集群的重定向
pytorch-线性回归
网络五连鞭
Unity xlua monoproxy mono proxy class
【SingleShotMultiBoxDetector(SSD,单步多框目标检测)】
ibatis的动态sql
一次生产环境redis内存占用居高不下问题排查
【主流Nivida显卡深度学习/强化学习/AI算力汇总】
Redirection of redis cluster
【yolov5.yaml解析】
Reading notes of growth hacker

