当前位置:网站首页>Introduction and advanced MySQL (13)
Introduction and advanced MySQL (13)
2022-07-29 03:09:00 【Xiaoxinai programming】
Exist as a condition at the location of the query condition
A. send ⽤in
Eg1: Check the students who failed the exam ⽣ list
B. send ⽤not in
Eg2: The query is not based on C language ⾔ Understand the learning of software programming exam ⽣ list
– A. Use in
– Eg1: Check the list of students who failed the exam
select studentid from exam where exam<60
select * from studentinfo where studentid in(
select studentid from exam where exam<60
)
– B. Use not in
– Eg2: The query is not based on C List of students for language understanding software programming exam
select * from subject
where subjectname=‘ be based on C Language understanding software programming ’
select studentid from exam where subjectid=1
select * from studentinfo where studentid not in(
select studentid from exam where subjectid=(
select subjectid from subject
where subjectname=‘ be based on C Language understanding software
Programming ’) )
C. send ⽤all
Eg3: Query results ⽐“C003” this ⻔ Any grade in the course is ⼤ Science ⽣ Test information .
D. send ⽤any
Eg4: Query results ⽐“C003” this ⻔ One of the courses ⼀ Achievements ⾼ Science ⽣ Test information
C. Use all: all >all( Subquery , The return value is multiple rows and one column ),
If the value is greater than all in the sub query results true It should be displayed, otherwise it will not be displayed :>max Eg3: Query score ratio “ be based on C Language understanding software programming ” Examination information of students whose grades are high in this course .
select * from `subject` where subjectname=' be based on C Language understanding software programming '
select * from exam where subjectid=1
select * from exam where exam>all(
select exam from exam where subjectid=(
select subjectid from `subject` where subjectname=' be based on C Language understanding software
Programming '));
select * from exam where exam>(
select max(exam) from exam where subjectid=(
select subjectid from `subject` where subjectname=' be based on C language
Understand software programming '))
-- D. Use any: arbitrarily ,>any( Subquery ) : Greater than any value in the subquery ,>min
-- Eg4: Query score ratio “C003” Examination information of a student with high scores in this course
select * from exam where exam>any(
select exam from exam where subjectid=(
select subjectid from `subject` where subjectname=' be based on C Language understanding software
Programming ' );
select * from exam where exam>(
select min(exam) from exam where subjectid=(
select subjectid from `subject` where subjectname=' be based on C language
Understand software programming ' ) );
边栏推荐
猜你喜欢
[freeswitch development practice] unimrcp compilation and installation
Add a row to a specific location in the dataframe
What if MySQL forgets the password
Learn more than 4000 words, understand the problem of this pointing in JS, and handwrite to realize call, apply and bind
My approval function of conference OA project
01-sdram: Code of initialization module
国产ERP有没有机会击败SAP ?
centos安装mysql8
力扣刷题之分数加减运算(每日一题7/27)
融云 IM & RTC 能力上新盘点
随机推荐
vasp计算任务报错:M_divide:can not subdivide 8 nodes by 6
12_ue4进阶_换一个更好看的人物模型
Flask的创建的流程day05-06之创建项目
C traps and defects Chapter 3 semantic "traps" 3.4 avoid "couple method"
Look at robot education and lead the mainstream of quality education
[QNX hypervisor 2.2 user manual]9.11 RAM (under update)
R language error: compilation failed for package '****‘
navicat新建数据库
Verilog:阻塞赋值和非阻塞赋值
年内首个“三连跌” 95号汽油回归“8元时代“
Let's talk about the summary of single merchant function modules
Learn more than 4000 words, understand the problem of this pointing in JS, and handwrite to realize call, apply and bind
Self study notes on Apache file management -- mapping folders and configuring Apache virtual machines based on single IP and multi domain names
瀚高数据库最佳实践配置工具HG_BP日志采集内容
STC单片机驱动1.8‘TFT SPI屏幕演示示例(含资料包)
C陷阱与缺陷 第3章 语义“陷阱” 3.6 边界计算与不对称边界
基于单片机烟雾温湿度甲醛监测设计
美联储再加息,75基点 鲍威尔“放鸽”,美股狂欢
[freeswitch development practice] unimrcp compilation and installation
万字详解 Google Play 上架应用标准包格式 AAB