当前位置:网站首页>MySQL数据库 - 连接查询
MySQL数据库 - 连接查询
2022-04-23 19:28:00 【x 心 动】
第1关:内连接查询
USE School;
########## 查询数据表中学生姓名和对应的班级 ##########
#请在此处添加实现代码
########## Begin ##########
select tb_student.name as studentName,tb_class.name as className from tb_student inner join tb_class on tb_student.class_id = tb_class.id;
########## End ##########
第2关:外连接查询
USE School;
########## 使用左外连接查询所有学生姓名和对应的班级 ##########
#请在此处添加实现代码
########## Begin ##########
select tb_student.name as studentName,tb_class.name as className from tb_student left join tb_class on tb_student.class_id = tb_class.id;
select tb_student.name as studentName,tb_class.name as className from tb_student right join tb_class on tb_student.class_id = tb_class.id;
########## End ##########
########## 使用右外连接查询所有学生姓名和对应的班级 ##########
#请在此处添加实现代码
########## Begin ##########
########## End ##########
第3关:复合条件连接查询
USE School;
########## 查询所有班级里分数在90分以上的学生的姓名和学生的成绩以及学生所在的班级 ##########
#请在此处添加实现代码
########## Begin ##########
select tb_student.name as studentName,tb_student.score, tb_class.name as className from tb_student join tb_class on tb_student.class_id =tb_class.id where score > 90 ;
########## End ##########
版权声明
本文为[x 心 动]所创,转载请带上原文链接,感谢
https://blog.csdn.net/qq_45623072/article/details/124055840
边栏推荐
- 指针数组与数组指针的区分
- Coordinate conversion WGS-84 to gcj-02 and gcj-02 to WGS-84
- MySQL数据库 - 单表查询(一)
- OpenHarmony开源开发者成长计划,寻找改变世界的开源新生力!
- An example of using JNI to directly access surface data
- Strange problems in FrameLayout view hierarchy
- Web Security
- MySQL数据库 - 单表查询(二)
- [H264] hevc H264 parsing and frame rate setting of the old version of libvlc
- 考试系统进入试卷优化思路
猜你喜欢
Why is PostgreSQL about to surpass SQL Server?
Wechat applet part of the mobile phone Preview PDF did not respond
Kubernetes入门到精通-裸机LoadBalence 80 443 端口暴露注意事项
ArcMap连接 arcgis server
ESP8266-入门第一篇
ArcMap publishing slicing service
5 minutes to achieve wechat cloud applet payment function (including source code)
[report] Microsoft: application of deep learning methods in speech enhancement
Use of fluent custom fonts and pictures
【webrtc】Add x264 encoder for CEF/Chromium
随机推荐
DevOps集成-Jenkins 服务的环境变量和构建工具 Tools
Reflection on the performance of some OpenGL operations in the past
Strange problems in FrameLayout view hierarchy
一个简单的(基于redisson的)分布式同步工具类封装
深度学习环境搭建步骤—gpu
openlayers 5.0 当地图容器大小改变时,重新加载地图
Class loading mechanism
【webrtc】Add x264 encoder for CEF/Chromium
NiO related Basics
Thoughts on the optimization of examination papers in the examination system
Openharmony open source developer growth plan, looking for new open source forces that change the world!
An idea of rendering pipeline based on FBO
openlayers 5.0 热力图
[报告] Microsoft :Application of deep learning methods in speech enhancement
数据分析学习目录
MySQL syntax collation
Kubernetes入门到精通-裸机LoadBalence 80 443 端口暴露注意事项
How to select the third-party package of golang
Translation of audio signal processing and coding: Preface
Why is PostgreSQL about to surpass SQL Server?