当前位置:网站首页>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
边栏推荐
猜你喜欢

JVM调试工具-Arthas

【图像融合】基于伪 Wigner 分布 (PWD) 实现图像融合附matlab代码

简单使用Modbus转BACnet网关教程
![buuctf misc [UTCTF2020]docx](/img/e4/e160f704d6aa754e85056840e14bd2.png)
buuctf misc [UTCTF2020]docx

MFC使用控制台时 项目路径中不能有空格和中文,否则会报错误 LNK1342 未能保存要编辑的二进制文件的备份副本等

In the middle of the year, I have prepared a small number of automated interview questions. Welcome to the self-test

Canal安装配置

Arduino raised $32million to enter the enterprise market

buuctf misc 从娃娃抓起

20 not to be missed ES6 tips
随机推荐
[problem solving] the connection to the server localhost:8080 was referred
The fund management of London gold is more important than others
[WordPress website] 5 Set code highlight
在产业互联网时代不再有真正意义上的中心,这些中心仅仅只是化有形为无形而已
EasyDSS_ The dash version solves the problem that the RTSP source address cannot play the video stream
Counter attack of flour dregs: MySQL 66 questions, 20000 words + 50 pictures
华为云图引擎服务
Cisco router configuration notes: static routing, rip, OSPF, principles combined with experiments, worth a visit!
Deploy loglistener in tke container to collect logs to CLS
Record the problem location experience when an application is suddenly killed
Serviceworker working mechanism and life cycle: resource caching and collaborative communication processing
Implementation and usage analysis of static pod
Intranet learning notes (4)
Face pincher: a hot meta universe stylist
【图像特征提取】基于脉冲耦合神经网络(PCNN)实现图像特征提取含Matlab源码
Prefix and topic training
Can the small fire Chunfeng tea make its debut by "keeping fit"?
0 foundation a literature club low code development member management applet (I)
电脑如何打开软键盘,教大家Win10如何打开软键盘的方法
如何删除/选择电脑上的输入法