当前位置:网站首页>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 .
边栏推荐
- MySQL statistics by day / week / month / quarter / half year / year
- [eye of depth wuenda machine learning homework class phase IV] summary of logistic regression
- Matlab 用法
- U盘内存卡数据丢失怎么恢复,这样操作也可以
- Why are two SQL statements that execute very fast, especially after the Union
- 关于#sql#的问题:创建一个名为View_XB视图,功能是①如果有重名的视图先删除后创建②显示XSB表中本班级的男女生各有多少人,并添加检查约束
- What are the constraints in MySQL? (instance verification)
- Excel中VLOOKUP函数简易使用——精确匹配或近似匹配数据
- 语音标注工具:Praat
- Summary of various series (harmonic, geometric)
猜你喜欢

sql语句concat搜索不出结果

1284_ Implementation analysis of FreeRTOS task priority acquisition

A high-frequency problem, three kinds of model thinking to solve this risk control problem

AI deep dive of Huawei cloud

表格背单词的方法

变形金刚Transformer详解

Taro 介绍

使用adb命令调试夜神模拟器

Flutter 文件读写-path_provider

New spark in intelligent era: wireless irrigation with Lora wireless transmission technology
随机推荐
[eye of depth wuenda machine learning homework class phase IV] summary of logistic regression
Flutter 文件读写-path_provider
sed 替换值为变量
重磅发布 | 《FISCO BCOS应用落地指南》
变形金刚Transformer详解
Indextree and Application
实战回忆录:从Webshell开始突破边界
语音标注自动音段对齐工具SPPAS使用笔记
语音合成:概述【不等长序列关系建模的生成任务】
AWS Iam inline policy example
Excel中VLOOKUP函数简易使用——精确匹配或近似匹配数据
A method to quickly connect notebook computers to mobile phone hotspots
hugetlbfs的写时复制
新版付费塔罗牌测算源码 (附带搭建教程)
324. 摆动排序 II / 剑指 Offer II 102. 加减的目标值
网上开股票账户真的安全吗?求答案
Swift中@dynamicMemberLookup和callAsFunction特性实现对象透明代理功能
实战回忆录从webshell开始突破边界
[quantitative investment system] problem records and Solutions
Message Oriented Middleware: pulsar