当前位置:网站首页>Oracle subquery
Oracle subquery
2022-06-29 08:32:00 【Mr. Li, a prodigy】
If a worker wants to do a good job, he must sharpen his tools first
Articles are constantly updated , You can search by wechat 【 Xiaoqi JAVA interview 】 First time reading , reply 【 Information 】 Access to benefits , reply 【 project 】 Get the source code of the project , reply 【 The resume template 】 Get resume template , reply 【 Learning Roadmap 】 Get a learning roadmap .

List of articles
- One 、 Subquery
- 1、 Query the information of the youngest student
- 2、 Query age and “ Zhang San ” Student information of the same size
- 3、 Check age , Gender and “ Zhang San ” The same student information , barring “ Zhang San ”
- 4、 Query age and “ Zhang San ” perhaps “ Li Si ” Same student information
- 5、 If there is a name “ Zhang San ” Of the students , Then find out all the student information , If no name is “ Zhang San ” Of the students , Just don't query anything
- Two 、 stay having Use subqueries in
- 3、 ... and 、 stay from Clause using subqueries
- Four 、 summary
One 、 Subquery
exists(): Judge , If the subquery returns data , Then execute the external query
1、 Query the information of the youngest student
select * from student where age = (select min(age) from student);
2、 Query age and “ Zhang San ” Student information of the same size
select * from student where age = (select age from student where name = ' Zhang San ')
3、 Check age , Gender and “ Zhang San ” The same student information , barring “ Zhang San ”
select * from student where (age,sex) = (select age,sex from student where name = ' Zhang San ')
and name <> ' Zhang San '
4、 Query age and “ Zhang San ” perhaps “ Li Si ” Same student information
select * from student where age in (select age from student where name =' Zhang San ' or ' Li Si ')
5、 If there is a name “ Zhang San ” Of the students , Then find out all the student information , If no name is “ Zhang San ” Of the students , Just don't query anything
select * from student where exists(select * from student where name = ' Zhang San ')
Two 、 stay having Use subqueries in
1、 Find out the classes whose class average score is higher than the grade average score 、 average 、 Class size
select class,count(*),avg(grade) from student group by class having avg(grade) > (select avg(grade) from student)
3、 ... and 、 stay from Clause using subqueries
1、 Ask the students id After class grouping with the teacher sid Equal student id
select s.id from student s (select t.id,t.class from teacher t group by t.class) where s.id = t.sid
Four 、 summary
The relevant contents here have not been sorted out yet , The article continues to be updated later , Recommended collection .
The commands involved in the article must be typed several times each like me , Only in the process of knocking can you find out whether you really master the command .
You can search by wechat 【 Xiaoqi JAVA interview 】 First time reading , reply 【 Information 】 Access to benefits , reply 【 project 】 Get the source code of the project , reply 【 The resume template 】 Get resume template , reply 【 Learning Roadmap 】 Get a learning roadmap .
边栏推荐
- Solidity deploy and validate agent contracts
- 互斥量互斥锁
- À propos de Hook
- 324. swing sort II / Sword finger offer II 102 Target value of addition and subtraction
- Want to open a stock account, is it safe to open a stock account online-
- Notice on organizing the second round of the Northwest Division (Shaanxi) of the 2021-2022 National Youth electronic information intelligent innovation competition
- 【Redis】Redis6学习框架思路和细节
- Np5 formatted output (III)
- NLP标注工具:Label Studio实现多用户协作打标
- 消息中间件:pulsar
猜你喜欢

蓝图基础

Speech signal processing - Fundamentals (I): basic acoustic knowledge

Explain the garbage collection mechanism (GC) in JVM

Hands on deep learning (I) -- linear neural network

表格背单词的方法

Linear regression with one variable
![[Kerberos] analysis of Kerberos authentication](/img/c5/d429bcf3c26d9476531362ef286734.png)
[Kerberos] analysis of Kerberos authentication

STM32基于HAL库的USART+DMA使用
![Target tracking [single target tracking (vot/sot), target detection, pedestrian re identification (re ID)]](/img/f2/d42032f05214a4ad9339ea18966cc2.jpg)
Target tracking [single target tracking (vot/sot), target detection, pedestrian re identification (re ID)]

After crossing, she said that the multiverse really exists
随机推荐
实战回忆录:从Webshell开始突破边界
考研英语易混词整理【闪过】
[Kerberos] analysis of Kerberos authentication
Robotframework learning notes: introduction to robot framework and browserlibrary (playwright)
Mongodb- connect to the database using the mongo/mongosh command line
Message Oriented Middleware: pulsar
SizeBalanceTree
Explain the garbage collection mechanism (GC) in JVM
AC automata
苹果开发者容易招致调查的若干行为
Sed replace value with variable
智能硬件evt dvt pvt mp
Binary search tree
Mosaic notes
表格背单词的方法
Speech signal processing - Fundamentals (I): basic acoustic knowledge
laravel 中 distinct() 的使用方法与去重
AWS Iam inline policy example
sed 替换值为变量
【微服务|OpenFeign】openfeign的超时时间