当前位置:网站首页>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 Formatall: 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 operationany: 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 operationin 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 operationThe 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 operationWhen 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 .
边栏推荐
- HDU4876ZCC loves cards(多校题)
- UVA 11080 – Place the Guards(二分图判定)
- Static analysis of software defects codesonar 5.2 release
- Phoenix JDBC
- Cocos2d-x game archive [easy to understand]
- easyui 日期控件清空值
- 使用高斯Redis实现二级索引
- [award publicity] issue 22 publicity of the award list in June 2022: Community star selection | Newcomer Award | blog synchronization | recommendation Award
- Do you have to make money in the account to open an account? Is the fund safe?
- npm uninstall和rm直接删除的区别
猜你喜欢
万字总结数据存储,三大知识点
Details of C language integer and floating-point data storage in memory (including details of original code, inverse code, complement, size end storage, etc.)
【OpenCV 例程200篇】223. 特征提取之多边形拟合(cv.approxPolyDP)
智能软件分析平台Embold
AADL inspector fault tree safety analysis module
Is embedded system really safe? [how does onespin comprehensively solve the IC integrity problem for the development team]
Klocwork 代码静态分析工具
Small guide for rapid formation of manipulator (12): inverse kinematics analysis
ERROR: 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your
目标:不排斥 yaml 语法。争取快速上手
随机推荐
GridView defines its own time for typesetting "suggestions collection"
Referrer和Referrer-Policy简介
How to meet the dual needs of security and confidentiality of medical devices?
Is it safe to open a stock account at present? Can I open an account online directly.
浅解ARC中的 __bridge、__bridge_retained和__bridge_transfer
万字总结数据存储,三大知识点
Deadlock conditions and preventive treatment [easy to understand]
使用高斯Redis实现二级索引
H3C s7000/s7500e/10500 series post stack BFD detection configuration method
What are the official stock trading apps in the country? Is it safe to use
Codesonar Webinar
Mysql子查询关键字的使用方式(exists)
Don't fall behind! Simple and easy-to-use low code development to quickly build an intelligent management information system
Jetty: configure connector [easy to understand]
Écrivez une liste de sauts
201215-03-19 - cocos2dx memory management - specific explanation "recommended collection"
Apifox interface integrated management new artifact
I have to use my ID card to open an account. Is the bank card safe? I don't understand it
Implement secondary index with Gaussian redis
Implementation of mahout Pearson correlation