当前位置:网站首页>Usage of MySQL subquery keywords (exists)
Usage of MySQL subquery keywords (exists)
2022-07-07 21:14:00 【1024 questions】
1. all
1.1 Format
1.2 characteristic
1.3 operation
2. any(some)
1.1 Format
1.2 characteristic
1.3 operation
3. in
1.1 Format
1.2 characteristic
1.3 operation
4. exist
1.1 Format
1.2 characteristic
1.3 operation
1.4 explain
1. all1.1 Formatall: Compared with all the values returned by the subquery, it is true Then return to true
all It can be done with =,>=,>,<,<=,<> Use a combination of , Respectively equal to , Greater than or equal to , Greater than , Less than , Less than or equal to , Not all the data in it
Greater than all Indicates that the value in the specified column must be greater than each value in the subquery set , That is, it must be greater than the maximum value of the sub query set ; If it is less than, it is less than the minimum value in the sub query .
1.3 operationany: Compared with all the values returned by the subquery, it is true Then return to true
any It can be done with =,>=,>,<,<=,<> Use a combination of , Respectively equal to , Greater than or equal to , Greater than , Less than , Less than or equal to , Not equal to any of the data
Greater than any Indicates that the value in the specified column must be greater than any value in the subquery set , The subset to be queried must be greater than the smallest ; Others in the same way
some It can be understood as any Another name for
1.3 operationin Used to determine the value of a record , Whether in the specified set
stay in Add... Before the keyword not You can reverse the conditions
1.3 operationThe subquery if “ There are data results ”( Return at least one row of data ), Then EXISTS() The result is :true, Outer query execution
The subquery if “ No data results ”( No data returned ), Then EXISTS() The result is :false, The outer query does not execute
EXISTS The following sub query does not return any actual data , Only return true or false , When true is returned where Conditions established
Be careful :EXISTS keyword , Than IN The operation efficiency of keywords is high , therefore , In actual development , Especially when there is a large amount of data , Recommended EXISTS keyword
1.3 operationWhen querying an outer query , The outer query is executed row by row , When the first line is executed , Determine whether the subquery is true, by true Then this line of data is found , Then the second line queries ... In reciprocating .
The above is personal experience , I hope I can give you a reference , I also hope you can support the software development network .
边栏推荐
- Cocos2d-x 游戏存档[通俗易懂]
- Numerical method for solving optimal control problem (0) -- Definition
- Small guide for rapid formation of manipulator (11): standard nomenclature of coordinate system
- Codesonar Webinar
- Feature generation
- Implement secondary index with Gaussian redis
- Le capital - investissement est - il légal en Chine? C'est sûr?
- POJ 3140 Contestants Division「建议收藏」
- Codeforces round 296 (Div. 2) A. playing with paper[easy to understand]
- Object-C programming tips timer "suggestions collection"
猜你喜欢
How to meet the dual needs of security and confidentiality of medical devices?
Implement secondary index with Gaussian redis
OneSpin | 解决IC设计中的硬件木马和安全信任问题
解决使用uni-app MediaError MediaError ErrorCode -5
神兵利器——敏感文件发现工具
C语言 整型 和 浮点型 数据在内存中存储详解(内含原码反码补码,大小端存储等详解)
Klocwork 代码静态分析工具
Small guide for rapid formation of manipulator (11): standard nomenclature of coordinate system
Static analysis of software defects codesonar 5.2 release
恶魔奶爸 B3 少量泛读,完成两万词汇量+
随机推荐
FatMouse&#39; Trade (Hangdian 1009)
【OpenCV 例程200篇】223. 特征提取之多边形拟合(cv.approxPolyDP)
Phoenix JDBC
写一下跳表
margin 等高布局
Is embedded system really safe? [how does onespin comprehensively solve the IC integrity problem for the development team]
Jetty:配置连接器[通俗易懂]
Codeforces 474 F. Ant colony
Tensorflow2.x下如何运行1.x的代码
MinGW MinGW-w64 TDM-GCC等工具链之间的差别与联系「建议收藏」
npm uninstall和rm直接删除的区别
开户必须往账户里面赚钱吗,资金安全吗?
【矩阵乘】【NOI 2012】【cogs963】随机数生成器
FatMouse&#39; Trade(杭电1009)
[paper reading] maps: Multi-Agent Reinforcement Learning Based Portfolio Management System
Feature generation
写了个 Markdown 命令行小工具,希望能提高园友们发文的效率!
Cocos2d-x 游戏存档[通俗易懂]
华泰证券可以做到万一佣金吗,万一开户安全嘛
恶魔奶爸 B2 突破语法,完成正统口语练习