当前位置:网站首页>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 .
边栏推荐
- 2022年在启牛开中银股票的账户安全吗?
- C language helps you understand pointers from multiple perspectives (1. Character pointers 2. Array pointers and pointer arrays, array parameter passing and pointer parameter passing 3. Function point
- [matrix multiplication] [noi 2012] [cogs963] random number generator
- CodeSonar如何帮助无人机查找软件缺陷?
- MySQL storage expression error
- 95年专注安全这一件事 沃尔沃未来聚焦智能驾驶与电气化领域安全
- Codeforces 474 F. Ant colony
- 恶魔奶爸 A1 语音听力初挑战
- 恶魔奶爸 A0 英文零基础的自我提升路
- Implementation of mahout Pearson correlation
猜你喜欢
How to meet the dual needs of security and confidentiality of medical devices?
MySQL约束之默认约束default与零填充约束zerofill
智能软件分析平台Embold
【OpenCV 例程200篇】223. 特征提取之多边形拟合(cv.approxPolyDP)
嵌入式系统真正安全了吗?[ OneSpin如何为开发团队全面解决IC完整性问题 ]
恶魔奶爸 B3 少量泛读,完成两万词汇量+
【C语言】指针进阶---指针你真的学懂了吗?
如何满足医疗设备对安全性和保密性的双重需求?
Codesonar Webinar
Helix QAC 2020.2新版静态测试工具,最大限度扩展了标准合规性的覆盖范围
随机推荐
Tensorflow2. How to run under x 1 Code of X
恶魔奶爸 B1 听力最后壁垒,一鼓作气突破
Data sorting in string
How can big state-owned banks break the anti fraud dilemma?
Intelligent software analysis platform embold
Guava multithreading, futurecallback thread calls are uneven
Implement secondary index with Gaussian redis
万字总结数据存储,三大知识点
Codeforces round 296 (Div. 2) A. playing with paper[easy to understand]
How to meet the dual needs of security and confidentiality of medical devices?
Deployment, recall and deletion solutions - stsadm and PowerShell "suggestions collection"
Lingyun going to sea | saihe & Huawei cloud: jointly help the sustainable development of cross-border e-commerce industry
特征生成
部署、收回和删除解决方式—-STSADM和PowerShell「建议收藏」
【函数递归】简单递归的5个经典例子,你都会吗?
Datatable data conversion to entity
阿里云有奖体验:如何通过ECS挂载NAS文件系统
MySQL storage expression error
Optimization cases of complex factor calculation: deep imbalance, buying and selling pressure index, volatility calculation
Mysql子查询关键字的使用方式(exists)