当前位置:网站首页>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 .
边栏推荐
- Klocwork 代码静态分析工具
- Écrivez une liste de sauts
- 浅解ARC中的 __bridge、__bridge_retained和__bridge_transfer
- 阿洛的烦恼
- A brief understanding of the in arc__ bridge、__ bridge_ Retained and__ bridge_ transfer
- Codeforces Round #296 (Div. 2) A. Playing with Paper[通俗易懂]
- 如何满足医疗设备对安全性和保密性的双重需求?
- 私募基金在中国合法吗?安全吗?
- Write a jump table
- uva 12230 – Crossing Rivers(概率)「建议收藏」
猜你喜欢

软件缺陷静态分析 CodeSonar 5.2 新版发布

Cantata9.0 | 全 新 功 能

AADL inspector fault tree safety analysis module
Klocwork code static analysis tool

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

目标:不排斥 yaml 语法。争取快速上手

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

Small guide for rapid formation of manipulator (11): standard nomenclature of coordinate system

如何满足医疗设备对安全性和保密性的双重需求?
![Is embedded system really safe? [how does onespin comprehensively solve the IC integrity problem for the development team]](/img/af/61b384b1b6ba46aa1a6011f8a30085.png)
Is embedded system really safe? [how does onespin comprehensively solve the IC integrity problem for the development team]
随机推荐
Codeforces 474 F. Ant colony
AADL Inspector 故障树安全分析模块
CodeSonar通过创新型静态分析增强软件可靠性
[matrix multiplication] [noi 2012] [cogs963] random number generator
Optimization cases of complex factor calculation: deep imbalance, buying and selling pressure index, volatility calculation
写了个 Markdown 命令行小工具,希望能提高园友们发文的效率!
万字总结数据存储,三大知识点
死锁的产生条件和预防处理[通俗易懂]
SQL注入报错注入函数图文详解
Cantata9.0 | new features
数值法求解最优控制问题(〇)——定义
恶魔奶爸 B1 听力最后壁垒,一鼓作气突破
写一下跳表
Is private equity legal in China? Is it safe?
国家正规的股票交易app有哪些?使用安不安全
Numerical method for solving optimal control problem (0) -- Definition
Deadlock conditions and preventive treatment [easy to understand]
POJ 3140 Contestants Division「建议收藏」
UVA 12230 – crossing rivers (probability) "suggested collection"
华泰证券可以做到万一佣金吗,万一开户安全嘛