当前位置:网站首页>MySQL - three tables (student, course, score) to query the name, number and score of students whose course is mathematics
MySQL - three tables (student, course, score) to query the name, number and score of students whose course is mathematics
2022-06-24 07:21:00 【The evening wind blows】
List of articles
One 、 Design table
1.student surface

2.subject surface

3.score surface

Two 、 Query data
demand : Query the names of students whose courses are mathematics , Number , achievement
Method 1 :
where Statement query
select student.sno,student.sname,score.score from student,subject,score where student.sno = score.sno and subject.cno = score.cno and subject.subject_name=" mathematics ";
Query results :
Method 2 :
Use internal connections
select surface 1. Field , surface 2. Field , surface 3. Field from surface 1 inner join surface 2 on surface 1. Field = surface 2. Field inner join surface 3 on surface 1. Field = surface 3. Field where Conditions ;
select s.sno,s.sname,c.score from student s inner join score c on s.sno=c.sno inner join subject u on c.cno=u.cno where u.subject_name=" mathematics "

analysis :
1、 View the three tables separately , Find the associated field
2、 Look at the table and you can see ,student Tabular sno And subject Tabular sno Can match ,subject And of table score Tabular cno matching , So you can filter the data through these two fields
3、 Add a designated account : mathematics , You can find the corresponding data
边栏推荐
- How to distinguish PAAS, IAAs and SaaS?
- Canal installation configuration
- 华为云数据库进阶学习
- Deploy loglistener in tke container to collect logs to CLS
- 【图像融合】基于NSST结合PCNN实现图像融合附matlab代码
- Huawei Cloud Database Advanced Learning
- Leetcode概率题面试突击系列11~15
- [WordPress website] 6 Article content copy prevention
- 如何删除/选择电脑上的输入法
- 0 foundation a literature club low code development member management applet (5)
猜你喜欢
![[GUET-CTF2019]zips](/img/79/22ff5d4a3cdc3fa9e0957ccc9bad4b.png)
[GUET-CTF2019]zips

Functions in setinterval cannot have parentheses

Arduino raised $32million to enter the enterprise market

The fund management of London gold is more important than others

【信号识别】基于深度学习CNN实现信号调制分类附matlab代码

Leetcode probability interview shock series 11~15
![[MRCTF2020]千层套路](/img/8e/d7b6e7025b87ea0f43a6123760a113.png)
[MRCTF2020]千层套路

【图像融合】基于NSST结合PCNN实现图像融合附matlab代码

Intranet learning notes (4)

PIP install XXX on the terminal but no module named XXX on pycharm
随机推荐
[TS] function type
JVM debugging tool -jps
How can genetic testing help patients fight disease?
The fund management of London gold is more important than others
0 foundation a literature club low code development member management applet (III)
[GUET-CTF2019]zips
JVM debugging tool -jstack
JVM调试工具-jps
【图像特征提取】基于脉冲耦合神经网络(PCNN)实现图像特征提取含Matlab源码
Bay area enterprises quick look! The focus of the data regulations of Shenzhen Special Economic Zone just released is coming!
buuctf misc 从娃娃抓起
The P2V and V2V software starwind converter is really easy to use
[security] how to [host security - hybrid cloud version] support secure access to non Tencent virtual machines
Deploy loglistener in tke container to collect logs to CLS
树莓派4B开发板入门
Software performance test analysis and tuning practice path - JMeter's performance pressure test analysis and tuning of RPC Services - manuscript excerpts
利用微搭低代码实现级联选择
JVM debugging tool -jvisualvm
【图像融合】基于伪 Wigner 分布 (PWD) 实现图像融合附matlab代码
Are internal consultants and external consultants in SAP implementation projects difficult or successful? [English version]