当前位置:网站首页>Introduction and advanced level of MySQL (12)
Introduction and advanced level of MySQL (12)
2022-07-29 03:09:00 【Xiaoxinai programming】
Exist as a condition at the location of the query condition
adopt = lead ⼊ Of ⼦ Inquire about , Must return a single value . Only match ⼀⾏. The value is ⼀ individual , But it can be combined
If only ⼀⾏⼀ The return value of the column is only ⼀ individual , Then you can. = > < >= <= in not in also ⾏
Eg: Find the same as Tan Ming ⼀ Urban Science ⽣ Information
Eg2: Find all the students with the lowest score ⽣ Information
– Subquery : The query result exists as the comparison value of the search condition
– Inquire about the student information in the same city as Ma Yu
select city from studentinfo where studentname=‘ Ma Yu ’
select * from studentinfo where city=‘ Shangqiu ’
– = matching , You must ensure that the value returned by the sub query is only one row and one column
select * from studentinfo where city=(select city from studentinfo where
studentname=‘ Ma Yu ’)
– > < != in( There can be multiple line ranges ) not IN
– Query the student information with the lowest score
select min(exam) from exam
select * from exam where exam=45
select * from studentinfo where studentid=‘2011001011’
select * from studentinfo where studentid=(
select studentid from exam where exam=(
select min(exam) from exam ) )
IN 、ANY 、ALL Of ⽐ Comparison operator quotation ⼊ On the list of ⼦ Inquire about ( Multiple columns can be returned )
If the return value is multiple ⾏ Under the circumstances : Can't make ⽤=> < these , Sure ⽤in not in >anyall <all These keywords
-- Query the student information with the lowest score : If there is only one person with the lowest score , Then you can. =
-- If there are many people , Must use in
select min(exam) from exam
select * from exam where exam=45
select * from studentinfo where studentid in('2011001011','2011001003')
select * from studentinfo where studentid in(
select studentid from exam where exam=(
select min(exam) from exam
)
)
边栏推荐
猜你喜欢

mycat读写分离配置

01-sdram: Code of initialization module

融云实时社区解决方案

MYCAT read / write separation configuration

13_ UE4 advanced_ Montage animation realizes attack while walking

Plato Farm在Elephant Swap上铸造的ePLATO是什么?为何具备高溢价?

2022-07-28 顾宇佳 学习笔记

Digital image processing Chapter 10 - image segmentation

Interpreting AI robots' pet raising and leading fashion trends

数字图像处理 第10章——图像分割
随机推荐
Redis configuration cache expiration listening event trigger
Chapter 2 VRP command line
Redis配置缓存过期监听事件触发
微信为之疯狂的Glide使用——之生命周期学习
MYSQL入门与进阶(十二)
Detailed steps for installing MySQL 8.0 under Linux
C traps and defects Chapter 3 semantic "traps" 3.6 Boundary Calculation and asymmetric boundary
融云实时社区解决方案
Chapter 09_ Use of performance analysis tools
[NPM error] - NPM err code eresolve and NPM err eresolve could not resolve problems
Look at robot education and lead the mainstream of quality education
Why did I choose the test when the development salary was high?
Alibaba Sentinel - 工作流程及原理解析
01-sdram: Code of initialization module
Unable to start after idea installation
Principle knowledge is useful
基于单片机烟雾温湿度甲醛监测设计
从零开始实现lmax-Disruptor队列(六)Disruptor 解决伪共享、消费者优雅停止实现原理解析
Object转String的几种方法
Weekly recommended short videos: how to make product development more effective?