【sql语句】查询一个学生在某一年的所有成绩与查询某一个班的高等数学的成绩

1.查询一个学生在某一年的所有成绩

select sc_student_id as 学号,sc_student_name as 姓名,

sc_course_name as 课程,sc_score as 分数

from t_score

where sc_student_id = 学生学号

and sc_edu_year = 201x-201x;

查询实例1

扫描二维码关注公众号,回复: 2159648 查看本文章

 

2.查询某一个班的高等数学的成绩

select cl.班级,cl.学生姓名,sc.sc_course_name as 科目,sc.sc_score as 成绩

from

(select st.st_class as 班级,st.st_name as 学生姓名,

from t_student as st

where st.st_class = 班级名) cl

left join t_score as sc

on cl.学生姓名 = sc.sc_student_name

where sc_course_name = "高等数学"

order by 成绩

查询实例2

 

猜你喜欢

转载自blog.csdn.net/qq_33591903/article/details/81040701