当前位置:网站首页>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 .
边栏推荐
- Datatable data conversion to entity
- Hdu4876zcc love cards (multi check questions)
- Cocos2d-x 游戏存档[通俗易懂]
- npm uninstall和rm直接删除的区别
- Implementation of mahout Pearson correlation
- How to meet the dual needs of security and confidentiality of medical devices?
- 【C语言】指针进阶---指针你真的学懂了吗?
- object-c编程tips-timer「建议收藏」
- POJ 3140 contents division "suggestions collection"
- Deadlock conditions and preventive treatment [easy to understand]
猜你喜欢

Apifox interface integrated management new artifact

AADL Inspector 故障树安全分析模块

Implement secondary index with Gaussian redis

Ubuntu安装mysql8遇到的问题以及详细安装过程

神兵利器——敏感文件发现工具

The latest version of codesonar has improved functional security and supports Misra, c++ parsing and visualization

H3C s7000/s7500e/10500 series post stack BFD detection configuration method

Nebula importer data import practice
Klocwork 代码静态分析工具

Onespin | solve the problems of hardware Trojan horse and security trust in IC Design
随机推荐
MySQL约束之默认约束default与零填充约束zerofill
开户必须往账户里面赚钱吗,资金安全吗?
Word inversion implements "suggestions collection"
特征生成
Lingyun going to sea | yidiantianxia & Huawei cloud: promoting the globalization of Chinese e-commerce enterprise brands
HDU4876ZCC loves cards(多校题)
【矩阵乘】【NOI 2012】【cogs963】随机数生成器
Postgresql数据库character varying和character的区别说明
The latest version of codesonar has improved functional security and supports Misra, c++ parsing and visualization
如何挑选基金产品?2022年7月份适合买什么基金?
Write a jump table
Codesonar Webinar
Is embedded system really safe? [how does onespin comprehensively solve the IC integrity problem for the development team]
Small guide for rapid formation of manipulator (12): inverse kinematics analysis
Tensorflow2. How to run under x 1 Code of X
Datatable data conversion to entity
解决使用uni-app MediaError MediaError ErrorCode -5
Codeforces 474 F. Ant colony
CodeSonar通过创新型静态分析增强软件可靠性
恶魔奶爸 指南帖——简易版