当前位置:网站首页>Oracle-多表查询
Oracle-多表查询
2022-06-27 10:36:00 【旷世奇才李先生】
工欲善其事必先利其器
文章持续更新,可以微信搜索【小奇JAVA面试】第一时间阅读,回复【资料】获取福利,回复【项目】获取项目源码,回复【简历模板】获取简历模板,回复【学习路线图】获取学习路线图。

一、连接查询
1、查询学生信息和老师信息,并且学生中的id,和老师中的sid相等。
select * from student,teacher where student.id = teacher.sid;
2、查询学生姓名和老师姓名,并且学生中的id,和老师中的sid相等。
select s.name,t.name from student s,teacher.t where s.id = t.sid;
3、查询学生姓名和老师姓名,并且学生中的id,和老师中的sid使用左连接查询。
select s.name,t.name from student s left join teacher t on s.id = t.sid;
4、查询学生姓名和老师姓名,并且学生中的id,和老师中的sid使用右连接查询。
select s.name,t.name from student s right join teacher t on s.id = t.sid;
5、查询学生姓名和老师姓名,并且学生中的id,和老师中的sid使用内连接查询。
select s.name,t.name from student s inner join teacher t on s.id = t.sid;
二、数据集合操作
交集、并集、差集、补集
1、查询所有的学生信息和学生姓名为“张三”的学生信息,如果重复去掉重复的。
select * from student
union
select * from student where name = '张三';
2、查询所有的学生信息和学生姓名为“张三”的学生信息,如果重复也显示出来。
select * from student
union all
select * from student where name = '张三';
3、查询所有的学生信息和学生姓名为“张三”的学生信息的交集,如果有相交的信息查询出来。
select * from student
intersect
select * from student where name = '张三';
4、查询所有的学生信息和学生姓名为“张三”的学生信息的差集(一方有的信息另一方没有就是差集)。
select * from student
minus
select * from student where name = '张三';
三、总结
这里的相关内容还没有整理完毕,文章后面持续更新,建议收藏。
文章中涉及到的命令大家一定要像我一样每个都敲几遍,只有在敲的过程中才能发现自己对命令是否真正的掌握了。
可以微信搜索【小奇JAVA面试】第一时间阅读,回复【资料】获取福利,回复【项目】获取项目源码,回复【简历模板】获取简历模板,回复【学习路线图】获取学习路线图。
边栏推荐
- 软件系统架构的演变
- 21:第三章:开发通行证服务:4:进一步完善【发送短信,接口】;(在【发送短信,接口】中,调用阿里云短信服务和redis服务;一种设计思想:BaseController;)
- Mail system (based on SMTP protocol and POP3 protocol -c language implementation)
- Easy to understand Laplace smoothing of naive Bayesian classification
- Privacy computing fat offline prediction
- 中科院微生物所招聘青年PI 20比特,2百萬安家費,千萬啟動經費(長期有效)
- leetcode:968. Monitor the binary tree [tree DP, maintain the three states of each node's subtree, it is very difficult to think of the right as a learning, analogous to the house raiding 3]
- “全班29人24人成功读研”冲上热搜!剩下的5个人去哪了?
- When does the mobile phone video roll off?
- [tcapulusdb knowledge base] Introduction to tmonitor stand-alone installation guidelines (I)
猜你喜欢

On anchors in object detection

在外企远程办公是什么体验? | 社区征文

oracle触发器 存储过程同时写入

Metadata of database
![[tcapulusdb knowledge base] Introduction to tmonitor background one click installation (I)](/img/0a/3eae294b335c120c4aabd05e4230c3.png)
[tcapulusdb knowledge base] Introduction to tmonitor background one click installation (I)

Design and Simulation of direct torque control system for induction motor (motion control matlab/simulink)

In the three-tier architecture, at which layer is the database design implemented, not at the data storage layer?

. Net
![leetcode:522. Longest special sequence II [greed + subsequence judgment]](/img/43/9b17e9cb5fee9d14c2986a2141889d.png)
leetcode:522. Longest special sequence II [greed + subsequence judgment]

Glide缓存机制
随机推荐
Change PIP mirror source
Explain the imaging principle of various optical instruments in detail
[tcapulusdb knowledge base] tcapulusdb machine initialization and launch introduction
【TcaplusDB知识库】TcaplusDB机型管理介绍
Privacy computing fat offline prediction
ci/cd自动化测试_CI / CD管道加快测试自动化的16种最佳实践
KDD 2022 | 基于分层图扩散学习的癫痫波预测
多线程实现 重写run(),怎么注入使用mapper文件操作数据库
【云享新鲜】社区周刊·Vol.68-华为云招募工业智能领域合作伙伴,强力扶持+商业变现
【HCIE-RS复习思维导图】- STP
堆-堆排序-TopK
Openpyxl table reading instance
Ci/cd automatic test_ 16 best practices for CI / CD pipeline to accelerate test automation
torch. utils. data. Randomsampler and torch utils. data. Differences between sequentialsampler
[tcapulusdb knowledge base] tcapulusdb tmonitor module architecture introduction
Go zero micro Service Practice Series (VII. How to optimize such a high demand)
.NET6接入Skywalking链路追踪完整流程
CPU design (single cycle and pipeline)
软件系统架构的演变
Glide缓存机制