当前位置:网站首页>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
边栏推荐
- Some ideas about time-consuming needs assessment
- Codeforces Round #783 (Div. 2) D题解
- uIP1.0 主动发送的问题理解
- Some speculation about the decline of adults' language learning ability
- openlayers 5.0 离散聚合点
- openlayers draw矩形
- Possible root causes include a too low setting for -Xss and illegal cyclic inheritance dependencies
- 对普通bean进行Autowired字段注入
- 数据分析学习目录
- Speculation on the way to realize the smooth drag preview of video editing software
猜你喜欢

Use of fluent custom fonts and pictures

MySQL syntax collation (2)

First experience of using fluent canvas

Using oes texture + glsurfaceview + JNI to realize player picture processing based on OpenGL es

优先使用组合而不使用继承
![[webrtc] add x264 encoder for CEF / Chromium](/img/3f/9bf73d6d2aec14ba94dfc6734eb6ac.png)
[webrtc] add x264 encoder for CEF / Chromium

Lottery applet, mother no longer have to worry about who does the dishes (assign tasks), so easy

Possible root causes include a too low setting for -Xss and illegal cyclic inheritance dependencies

Is meituan, a profit-making company with zero foundation, hungry? Coupon CPS applet (with source code)

深度分析数据恢复原理——那些数据可以恢复那些不可以数据恢复软件
随机推荐
Deep learning -- Summary of Feature Engineering
Virtual machine performance monitoring and fault handling tools
音频编辑生成软件
Hot reload debugging
Garbage collector and memory allocation strategy
JS controls the file type and size when uploading files
openlayers draw矩形
5 minutes to achieve wechat cloud applet payment function (including source code)
Transaction processing of SQL Server database
openlayers 5.0 两种居中方式
Zero base to build profit taking away CPS platform official account
White screen processing method of fulter startup page
How to uninstall easyton
MySQL syntax collation
Go recursively loops through folders
Coordinate conversion WGS-84 to gcj-02 and gcj-02 to WGS-84
Translation of audio signal processing and coding: Preface
openlayers 5.0 离散聚合点
精简CUDA教程——CUDA Driver API
Encyclopedia of professional terms and abbreviations in communication engineering