当前位置:网站首页>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 Format 1.2 characteristicall: 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 operation 2. any(some)1.1 Format 1.2 characteristicany: 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 operation 3. in1.1 Format 1.2 characteristicin 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 operation 4. exist1.1 Format 1.2 characteristicThe 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 operation 1.4 explainWhen 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 .
边栏推荐
- AADL Inspector 故障树安全分析模块
- Details of C language integer and floating-point data storage in memory (including details of original code, inverse code, complement, size end storage, etc.)
- Intelligent software analysis platform embold
- 特征生成
- sqlHelper的增删改查
- MinGW MinGW-w64 TDM-GCC等工具链之间的差别与联系「建议收藏」
- 【函数递归】简单递归的5个经典例子,你都会吗?
- Nebula importer data import practice
- Codeforces Round #275 (Div. 2) C – Diverse Permutation (构造)[通俗易懂]
- 如何挑选基金产品?2022年7月份适合买什么基金?
猜你喜欢
嵌入式系统真正安全了吗?[ OneSpin如何为开发团队全面解决IC完整性问题 ]
Tensorflow2.x下如何运行1.x的代码
Mysql子查询关键字的使用方式(exists)
Lex & yacc of Pisa proxy SQL parsing
Don't fall behind! Simple and easy-to-use low code development to quickly build an intelligent management information system
SQL注入报错注入函数图文详解
How does codesonar help UAVs find software defects?
Helix QAC 2020.2新版静态测试工具,最大限度扩展了标准合规性的覆盖范围
万字总结数据存储,三大知识点
Klocwork 代码静态分析工具
随机推荐
软件缺陷静态分析 CodeSonar 5.2 新版发布
POJ 3140 contents division "suggestions collection"
Écrivez une liste de sauts
开户必须往账户里面赚钱吗,资金安全吗?
Le capital - investissement est - il légal en Chine? C'est sûr?
Jetty:配置连接器[通俗易懂]
AADL inspector fault tree safety analysis module
Guava multithreading, futurecallback thread calls are uneven
Unity3d 4.3.4f1 execution project
Is it safe to open an account of BOC shares in kainiu in 2022?
Ubuntu安装mysql8遇到的问题以及详细安装过程
sqlHelper的增删改查
使用高斯Redis实现二级索引
201215-03-19—cocos2dx内存管理–具体解释「建议收藏」
UVA 11080 – place the guards
阿洛的烦恼
恶魔奶爸 A3阶段 近常速语流初接触
Hdu4876zcc love cards (multi check questions)
Spark judges that DF is empty
目标:不排斥 yaml 语法。争取快速上手