SQL数据库命令,求救查询平均成绩!万分感谢!

2024-11-24 20:30:43
推荐回答(5个)
回答1:

SQL数据库命令,求救查询平均成绩!
select 学号, avg(分数) from grade group by 学号 having count(distinct 课程编号) > 1

select 学号 as u_编号, 姓名 as u_名称
from student_info where 姓名 like '张%'
union
select 课程编号 as u_编号, 课程名称 as u_名称
from curriculum

回答2:

select 学号, avg(分数) from grade group by 学号 having count(distinct 课程编号) > 1;

我看这种不要用union了吧,不然数据排列不好看吧。。。。。
select grade.学号 as u_学号,curriculum.课程编号 as u_编号,curriculum.课程名称 as u_名称。
from curriculum,grade,student_info
where where student_info.姓名 like '张%' and student_info.学号=grade.学号
and grade.课程编号=grade.课程编号

回答3:

1,select b.学号,b.姓名,avg(a.分数) as 平均分 from grade a inner join student_info b on a.学号=b.学号 group by b.学号,b.姓名 having count(*)>=2
2, create table newTable as
select 学号 as u_编号, 姓名 as u_名称
from student_info where 姓名 like '张%'
union all
select 课程编号 as u_编号, 课程名称 as u_名称
from curriculum

回答4:

select 学号, avg(分数) from grade group by 学号 having count(distinct 课程编号) > 1

select 学号 as u_编号, 姓名 as u_名称
from student_info where 姓名 like '张%'
union
select 课程编号 as u_编号, 课程名称 as u_名称
from curriculum

回答5:

老师给的ppt里面有方法,套进去就ok啦