当前位置:网站首页>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
all: 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

any: 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

in 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

The 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
When 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 .
边栏推荐
- ERROR: 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your
- [paper reading] maps: Multi-Agent Reinforcement Learning Based Portfolio Management System
- 写了个 Markdown 命令行小工具,希望能提高园友们发文的效率!
- Codesonar Webinar
- [function recursion] do you know all five classic examples of simple recursion?
- 数值法求解最优控制问题(〇)——定义
- 阿洛的烦恼
- HDU4876ZCC loves cards(多校题)
- gridView自己定义做时间排版「建议收藏」
- 写一下跳表
猜你喜欢

使用高斯Redis实现二级索引

Optimization cases of complex factor calculation: deep imbalance, buying and selling pressure index, volatility calculation

Apifox interface integrated management new artifact

解决使用uni-app MediaError MediaError ErrorCode -5

智能软件分析平台Embold

如何满足医疗设备对安全性和保密性的双重需求?

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

Nebula importer data import practice

How does codesonar help UAVs find software defects?

Codesonar Webinar
随机推荐
私募基金在中國合法嗎?安全嗎?
Lingyun going to sea | saihe & Huawei cloud: jointly help the sustainable development of cross-border e-commerce industry
sqlHelper的增删改查
Lingyun going to sea | yidiantianxia & Huawei cloud: promoting the globalization of Chinese e-commerce enterprise brands
Guava multithreading, futurecallback thread calls are uneven
程序猿赚的那点钱算个P啊!
AADL Inspector 故障树安全分析模块
部署、收回和删除解决方式—-STSADM和PowerShell「建议收藏」
FatMouse&#39; Trade(杭电1009)
【矩阵乘】【NOI 2012】【cogs963】随机数生成器
Helix QAC 2020.2 new static test tool maximizes the coverage of standard compliance
万字总结数据存储,三大知识点
Codeforces round 275 (Div. 2) C – diverse permutation (construction) [easy to understand]
阿里云有奖体验:如何通过ECS挂载NAS文件系统
Small guide for rapid formation of manipulator (12): inverse kinematics analysis
Optimization cases of complex factor calculation: deep imbalance, buying and selling pressure index, volatility calculation
Hdu4876zcc love cards (multi check questions)
恶魔奶爸 B2 突破语法,完成正统口语练习
Codeforces Round #296 (Div. 2) A. Playing with Paper[通俗易懂]
Tensorflow2.x下如何运行1.x的代码